Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

As sturkmen said, it's quite easy. Capture the images in a loop using the VideoCapture module, then detect the faces with a Haar cascade classifier, which will give the face rectangle. Then wait till the rectangle gets in the desired area of the image. Something like:

if((face.w*face*h>min_surface)&&(face.x>target.x0)&&(face.y>target.y0)&&(face.x+face.w<target.x1)&&(face.y+face.h>target.y1) { imwrite(image,"goodcapture.jpg"); break; }

Some docs: video capture: face detection: