1 | initial version |
First you need to identify the scratches. There are several methods to do this, maybe the simples is to check the anisotropy in the image.
Compute the Gx
and Gy
gradients of the image, on a sliding window compute the matrix
[ Sum(Gx²) Sum(GxGy) ]
[ Sum(GxGy) Sum(Gy²) ]
Then get lambda1
and lambda2
using PCA analysis. The window has a strong directional component (scratch) if lambda1
is much greater than lambda2
.
Using the anisotropic parts of the image, get the mask of the skretches.
Finally, erase the skretches using inpainting.