img = Import /@ {"http://i.stack.imgur.com/klqh9.png",
"http://i.stack.imgur.com/zCjXN.png"};
mask = Dilation[Binarize[First@img, {0, .15}], 2]

Then we get
result=Inpaint[#,mask,Method->"TextureSynthesis"]&/@img

As you see that arrow point out.The effect is very bad.We get some thing look like a blob,especially that grayscale image have a obvious situation.So how to get a better result with that grayscale image?
update
Since the @bill s's comment and the @Berg's answer think we can convert the RGB image convert to grayscale image.So I update this question to specify maybe this is not good methed.And you can see the last image is the worst.
ImageAssemble[{Last@img, Last@result,
ColorConvert[First@result, "Grayscale"]}]

Answer
There's not much information about what "TextureSynthesis" does in the documentation, but it probably does something roughly like this:
- Look at the pixels at the border of each inpainting region.
- Look for nearby similar pixels.
- Generate a texture based on the pixels found in (2)
Let's look at one region in detail:
The border of the inpainting mask is marked red in the image on the right.
If you look at the pixels near that border, they're mostly orange, some slightly darker orange.
Now if I look for similar pixels in the neighborhood, I will find (almost exclusively) bright orange pixels. There are darker pixels in the neighborhood, but they have a different color, so they're not very similar.
And that's most likely the reason you get different results for the gray scale image: In the gray scale image, if there are darker pixels at the mask border, Inpaint will find "similar" pixels (in gray value) in the neighborhood - so it will generate an inpainting texture based on these pixels too. And that means you get a darker inpainted region.

Comments
Post a Comment