How to retouch (smart fill) photo image?

Here's a google drive link to the Notebook.

  1. Use "Mask tool" to select area to inpaint, copy as image, store somewhere.
  2. Do the same to select the area which should be used to probe texture from.
  3. Repeat for all environments.
  4. Fold Inpaint.

enter image description here

enter image description here

A GIF animation of the masks (included here in order to make the post self-contained):

masks

img = Import["http://i.stack.imgur.com/d3AXT.jpg"];

{waterMask, waterSource, headMask, headSource, shadowMask, shadowSource, edgeMask, 
  edgeSource, coatMask, coatSource} = Import["http://i.stack.imgur.com/x4v6b.gif"];

Fold[
 Inpaint[#, First@#2, 
   Method -> {"TextureSynthesis", Masking -> Last@#2}] &,
 img,
 {
  {waterMask, waterSource},
  {headMask, headSource},
  {shadowMask, shadowSource},
  {edgeMask, edgeSource},
  {coatMask, coatSource}
  }
 ]

enter image description here

I have to polish a handrail but looks quite good.


Here is a way to do it, but it needs a lot 'artistic' touch.

First Import the image.

img = Import["http://i.stack.imgur.com/d3AXT.jpg"];

Then create the Mask using interface (thanks Kuba).

enter image description here

From orange Copy choose Mask as ...

mask = (*Ctrl+v*)

enter image description here

Finally

Inpaint[img, mask] 

enter image description here

I guess you have to do some fine tuning by hand. Try hard and you can make him completely disappear. I don't have that much talent or courage to mess with history.


If you want to do it with numbers then find the location of right person.

{x1, x2} = {545, 800};
{y1, y2} = {10, 500};
{l, h} = ImageDimensions[img];
i1 = ImageTake[img, {h - y2, h - y1}, {x1, x2}]

i2 = Graphics[{Inset[i1, {x1, y1}, {0, 0}, {x2 - x1, y2 - y1}]}, 
     PlotRange -> {{1, l}, {1, h}}, ImageSize -> {l, h}];
mask = DeleteSmallComponents@FillingTransform@ChanVeseBinarize[i2, 
     "TargetColor" -> Darker[Gray]]