Hello!
Anyone who often scans photos knows how much time it sometimes takes to clean a scan of dust and other analog garbage.
It would seem that the solution is obvious - wipe the scanner well, but not everything is as simple as you want.
First, ideally, the glass still can not be cleaned, secondly, the dust can be from the inside, and thirdly, the problem, as it turns out, is not only dust.
')
Meanwhile, it is realistic to quickly get a quality result on a more or less cheap household scanner.
I'm not a programmer, so I just want to share the idea of automatic cleaning with respected habrovchanami. If any Russian company brings the algorithm to life, I will be glad.
Those who, like me, are still cleaning the photos by hand, perhaps they will also find something useful under the cut (and ~ 500-600 kb of pictures).
So, I had 4 problems with scanners:
- dirt and dust on the glass;
- color halo around the contours;
- inaccuracy of the scanner drive;
- noise of the final image.
If the last 3 problems are probably solved in more expensive models, then even the price does not save from dust.
But it is no secret that the dust on the scanner turns mainly into white spots.
Therefore, I propose to automatically eliminate dust and color distortion using a 2-pass scan.
The idea is simple: we scan the same image with a 180-degree rotation, and use the darker areas of the image from 2 results.

Only a few dozen grains of dust remained, which was on the print itself.
Note that the result was obtained without loss of image details and without a single stroke of the retouching brush, which greatly saves time.
In the same way, but by simple mixing 50 to 50, colored halos near the contours are eliminated:

There is one inconvenience: most likely, to combine the whole picture at once will not work.
Apparently, the scanner sensor moves unevenly, the picture is deformed in places more strongly, and simple stretching and compression of the entire image does not help.
Therefore, manually have to be processed in chunks.
But, I think, if a similar scanning algorithm is implemented in the program, then it will not be so difficult to automatically find the outlines of the images and combine them.
By the way, even the proportions of the image themselves turn out to be different when scanning with a rotation of 90 °:

At the same time, along the same axis, perpendicular to the movement of the scanner, the size should be correct.
And by adding another pass with a rotation of 90 °, you can eliminate the unevenness of the scanner drive and get the exact dimensions in both axes.
Total, we scan the picture 3 times and at the output (fully automatically in the case of the program) we get close to the ideal - for this scanner - an image.
There are a lot of programs that allow cleaning the residual noise of the image.
Of course, it is possible that such a method has already been implemented by someone, and only I do not know such programs.
What do you say, Habra-people?