7
$\begingroup$

How to remove spider from "spider web"?

enter image description here

there is good example in documentation center

enter image description here

but how to make black marker of spider?

$\endgroup$
  • $\begingroup$ You will need the mask first. Do you have the mask? $\endgroup$ – Kattern Apr 20 '16 at 9:26
12
$\begingroup$

This is a fast and quite good way to create the mask of the spider:

i = Import["http://i.stack.imgur.com/2Lz0A.jpg"];
mask = Dilation[
  DeleteSmallComponents@ ColorNegate@ DeleteSmallComponents@
    MorphologicalBinarize[i, .25], 
  DiskMatrix[2]]

spider_mask

Then, you can use Inpaint with the generated mask:

Inpaint[i, mask]

inpainted_web

You will have to adjust the MorphologicalBinarize threshold value to achieve good results for other images.

$\endgroup$
2
$\begingroup$

You should first generate the mask, then you can apply Inpaint. Following is a demo, it can be further enhanced.

flt = ColorNegate@MorphologicalBinarize[img, {0.4, 0.9}];
Inpaint[img, flt];

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy