Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

How to grab pixel coordinates of detected face/eyes?

I've got face and eye detection/tracking running and I'm interested in having OpenCV provide the coordinates of the initial cv2.rectangle corner coordinates. The rectangle is built using frame:

 cv2.rectangle(frame, (rect[0], rect[1]), (rect[2], rect[3]), (0, 255, 0), 2)

Is rect[0], rect[1] the "upper left" corner of the rectangle, and rect[3], rect[4] the "lower right" corner?

My goal is to have these parameters drive servos that will keep the moving face "centered" by having the camera move based on these variable values (as a relative position to center image coordinates less rectangle dimension offset).

Thanks for your help,

Dave