Ask Your Question

How can I effectively remove the scratch from the image?

asked 2019-06-23 15:34:23 -0500

me16b001 gravatar image

I need to get an image before the scratch is made. One possible technique is to compare the value of the pixels at both the boundaries of the scratch. Also, how do I identify this scratch and draw a line over it in python using OpenCV? I have tried the Hough's method but no luck. image description

edit retag flag offensive close merge delete

1 answer

Sort by » oldest newest most voted

answered 2019-06-24 03:07:42 -0500

kbarni gravatar image

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.

edit flag offensive delete link more


Any hints on how to proceed about the anisotropy part?

me16b001 gravatar imageme16b001 ( 2019-06-24 15:26:20 -0500 )edit

That's described in my answer.

kbarni gravatar imagekbarni ( 2019-06-26 16:02:57 -0500 )edit
Login/Signup to Answer

Question Tools

1 follower


Asked: 2019-06-23 15:34:23 -0500

Seen: 144 times

Last updated: Jun 24 '19