Ask Your Question
0

Cropping a face out of an image and leave a black rectangle on the original image

asked 2019-03-15 14:47:13 -0600

ray4 gravatar image

I have an image with multiple faces. Each time I detect a face I want to remove the thumbnail and leave a black rectangle where the face was. How do I leave that black rectangle on the original image where the face was? I am am doing this in Java.

Thanks

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2019-03-16 02:35:32 -0600

berak gravatar image

it's not very difficult. assuming you get Rect for each face from the detection:

Mat roi = image.submat(rect);
roi.setTo(Scalar.all(0));
edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2019-03-15 14:47:13 -0600

Seen: 385 times

Last updated: Mar 16 '19