Code for face detection Download the haarcascade_frontalface_default below Download other xml from the OpenCV Github repository from this link