D
D
Dmitry2015-12-16 21:25:19
Python
Dmitry, 2015-12-16 21:25:19

How to get rid of scratches on the image?

Good day!
There was a need to process a photograph obtained long ago (the result of laser beam diffraction in the photograph). But the whole photo is "scratched" and the processing result is distorted.
Tell me how you can programmatically (or manually in editors) get rid of scratches.
The tags indicate python, since I mainly use this language and have already tried to process it using the FFT (Fourier Transform) package.
but this approach did not give anything good.
saveimg.ru/show-image.php?id=10653485e8a88b4c6a76e...

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Mrrl, 2015-12-17
@Mrl

If you don’t feel sorry for the time, then you can try this:
- take all pairs of points located on different sides of the square
- connect each such pair with a segment, and calculate the average brightness on it (this is approximately the same as the Hough transform, only more specialized for the task . And much longer)
- a function of two variables is obtained. We are looking for its maximum - this is the brightest scratch.
- look at parallel lines in the neighborhood, find the width of the peak (width of the scratch)
- replace the points on the found scratch with a linear interpolation of the nearest points lying outside it. Or we just mark the points of the strip as incorrect, and move on.
- remove this peak on the two-dimensional function, go to the next maximum.
- after removing 10 (or 50, or 100) scratches, show the picture and ask whether to continue.
- if you continue - recalculate the function again.
The main question will be "how to calculate the peak width". I don't know, I need to look at specific charts.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question