문제

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

도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top