Asked — Edited

Example Script For Facedetect.Vision.Detection.Haarrectangle


I have some Python code working that uses CameraFaceDetection.GetFaceDetection(), and I will post this soon. But it only outputs the region where the face is.

I looked for an example script that calls FaceDetect.Vision.Detection.HaarRectangle, which I'm guessing gives exact coordinates.

Can anyone point me to such an example? The language doesn't matter, just so long as I can see most of the functions and parameters.



Upgrade to ARC Pro

Synthiam ARC Pro is a new tool that will help unleash your creativity with programming robots in just seconds!


CAmeraFaceDetection.GetFaceDetection() will return the Rect, CenterX, CenterY, IsFound and more. It returns an ObjectLocation which is packed full of coordinates and details.

The Rect will give you the exact coordinates. The CenterX and CenterY will give you the center coordinates. I don't think there is anything else you can expect. A graphic image only has X/Y coordinates, so a Rect is a summary of that.

What additional information are you looking for?


Perfect. I couldn't see these functions in any of the examples I looked at. I now have the center of the face, in Python syntax ('--' means tab):

f1 = _camera.CameraFaceDetection.GetFaceDetection() if f1.isFound == False: --print 'No face detected' else: --print f1.verticalLocation,f1.horizontalLocation --print f1.CenterX, f1.CenterY


Excellent! And the Rect within the ObjectLocation contains the size of the face :D