Question

For face detection I have used the haarcascade_frontalface_alt.xml.

The problem is that the this this algorithm gives me a roi a little bit larger so the rectangle catches some hair and some of the background. Is there a solution to change the dimension of this rectangle?

This what the haarcascade_frontalface_alt.xml detects:

enter image description here

And this what I want to detect:

enter image description here

Was it helpful?

Solution

You cannot reply on OpenCV to do this because its model is trained based on face images just like the first one. That is to say, it is supposed to give face detections like the first one.

Instead, consider to crop the detected rectangles a little bit, whatever size you want it be.


To be more accurate, you can crop the faces based on the facial features, as discussed in this thread.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top