gmic icon indicating copy to clipboard operation
gmic copied to clipboard

feature request: optional mask for inpainting to indicate which patches can be used to fill the hole

Open Benoit1213 opened this issue 4 years ago • 0 comments

Hi David,

would it be possible to add a second mask, which marks regions of the image the inpainting algorithm is not allowed to use or inversely is only allowed to use, as an additional parameter to the inpaint_matchpatch function?

To clarify, I have images like the following in which I want to inpaint some holes. This usually works very well with the inpaint_matchpatch function, but in some cases the holes are filled with patches from the skin part of the image or with patches from the black border around the texture. Therefore I think it would be beneficial if you were able to give a second mask as parameter which indicates in which regions the inpainting algorithm is allowed to look for matching patches.

I already tried to achieve this by setting the transparency, of the pixel I don't want to be used for inpainting, to zero (using .png format) but gmic / inpaint_matchpatch seem to ignore the transparency information.

Original image Original image

Mask which indicates the hole to be inpainted Mask which indicates the hole to be inpainted

Result where patches from the skin area where used to fill in the hole in the clothing area Result where patches from the skin area where used to fill in the hole in the clothing area

Optional mask I am proposing which indicates which patches can be used to fill in the hole Optional mask I am proposing which indicates which patches can be used to fill in the hole

Benoit1213 avatar Jun 30 '20 15:06 Benoit1213