So I made a little script which tracks the face, then search for the two eyes, then for each eye, left and right.
The problem is, even with left and right it overlaps both.
i = Camera().getImage()
face = i.findHaarFeatures("face.xml")
if face != None:
face = face[0].boundingBox()
face = i.crop(face)
twoeyes = face.findHaarFeatures("two_eyes_big.xml")
if twoeyes != None:
righteye = face.findHaarFeatures('right_eye.xml')
lefteye = face.findHaarFeatures('lefteye.xml')
if righteye != None and lefteye != None:
print righteye,lefteye
righteye = righteye[0].draw()
lefteye = lefteye[0].draw()
face.show()
the print shows that:
[SimpleCV.Features.Detection.HaarFeature at (61,67)] [SimpleCV.Features.Detection.HaarFeature at (60,65)]
I tried cropping the face with the face.boundingBox(twoeyes) and them search for the left and right but it always gives me (None, None).
Also I'm having a problem with findHaarFeatures("face.xml") when it gives me more than 1 face, I overcome this by just picking the first one in the list, but I would like to pick the biggest of them, how can I compare the size of two Features?
And at last, is there a better way to do the find of a features inside other instead of using the crop and the if-statement 'something != None'?
Btw, I'm using the raw image from the camera, is it better to treat it with some contrast, saturation, findedges or anything else to better find features?