# Eliminating pen marks in an image

I 'm trying to get a code that can delete what I wrote with a pen on my hand.

I created a mask to delimit the area where I wanted to change the colors.

This was my first attempt :

i = Import["C:\\Users\\Leandro\\Desktop\\Hand.jpg"]; mask = Graphics[{Black, Rectangle[{0, 0}, {2176, 1624}], White,Rectangle[{709, 575}, {1345, 854}]}]; bbb = ColorReplace[i, mask -> Blue]; ChanVeseBinarize[bbb];


This was my second attempt :

mask2 = Graphics[{Black, Rectangle[{0, 0}, {2176, 1624}], White, Rectangle[{753.112, 638.37}, {757.227, 642.485}]}]; ColorReplace[i, mask2 -> Black]


I could highlight the word , but I can not treat it so that it disappears from the original image.

• – Kuba
Aug 17 '16 at 21:44

This is a first pass without refinement. Note: after deleting small components there were 4 components. The last 3 were the letters. It is ugly but a start:

i = Import["http://i.stack.imgur.com/NgJUB.jpg"];
cs = ColorSeparate[i];
is = DeleteSmallComponents[
b = ColorNegate[Binarize[ImageSubtract[cs[[1]], cs[[3]]]]]];
m =DeleteSmallComponents[ImageSubtract[b, is]];

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