Reputation: 220
I'm using openCV in Python3.6 to detect faces in an image. It works well enough and detects the face, but I'd like the rectangle to include more of the face (chin, hair, etc.) since those parts are important in recognizing the person. I'm using this code.
How can I get the program to select more of the face?
Here's an example of what I'm getting (censored for privacy of course)
Upvotes: 1
Views: 6047
Reputation: 25094
When it creates the rectangle, just set a offset/padding
padding = 10
cv2.rectangle(img,(x-padding,y-padding),(x+w+padding,y+h+padding),(255,0,0),2)
Upvotes: 5