Ask Your Question

Modifying inpainting to achieve proper blur

asked 2017-06-12 04:26:15 -0500

arqam gravatar image

updated 2017-06-12 05:52:17 -0500

I am trying to do some image processing for which I need to remove the facial features like eyes, nose, lips etc. I have the following contour points

image description

I have cartoonised this image to get this ::

image description

Now I have to remove the facial features namely eyes, nose, lips and have the skin in place or that. The thing is that I don't have to do just for this image but for a general image that the user uploads.

I am trying using inpainting but it does create some problem, especially around lips where its having beards in neighbouring pixels and it gives a blackish output like this ::

image description

I tried different contour points and shapes but somewhere or the other its causing problem mainly because of hair or beards. So how to achieve what I am trying to?

Code :: Photo.inpaint(finalImage,imageROIGRAY,imageROIDest,8,Photo.INPAINT_NS);

I have done dilation also on the mask, but doesn't work.

Showing mask for one of the shape formed using the contour points ::

image description

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2017-06-12 05:15:03 -0500

lohachan0108 gravatar image

updated 2017-06-12 05:27:49 -0500

This cartoonised image does not work as a proper mask. You need to create a mask for your eyes and other facial features if you want to remove them. Create a binary mask (maybe you can use MS Paint or for more accurate results you can use Photoshop) painting your facial features black and the rest as white. Pass it as the second argument and it will blur out all your facial features. Hope it helps :)! This is the photo from which I want to blur the kid. This is the mask I use to blur it. This is the final result I get on using a binary mask.

edit flag offensive delete link more


I think I was not clear. I created the mask also, using the path from the contour points as shown in the first image. In the Code imageROIGRAY is that.

arqam gravatar imagearqam ( 2017-06-12 05:46:07 -0500 )edit

Create a mask only for facial features such as eyes. Not the entire face. Creating for the entire face does not guarantee proper blurred regions for inside the face.

lohachan0108 gravatar imagelohachan0108 ( 2017-06-12 23:34:50 -0500 )edit

I tried that also but it has nearby hair for example beside left eye which does not give the correct image after inpainting. Example ::

arqam gravatar imagearqam ( 2017-06-13 00:43:37 -0500 )edit
Login/Signup to Answer

Question Tools

1 follower


Asked: 2017-06-12 04:26:15 -0500

Seen: 211 times

Last updated: Jun 12 '17