Detecting dirt on scanner glass (via scanned photo)

Hi. I have been dealing with a difficult to find issue. I have a FastFoto scanner which is an Automatic Document Feeder. As it feeds the images, it scans via fixed scanner elements. This works well but if there is dirt or some sort of debree on the scanner glass then it results in a very narrow line on the scanned image. I tried using examples utilizing HoughLines and HouphLinesP and even with a threshold of 1, it was unable to pick this line up. Is there anyone they knows a simple way to detect whether I need to clean the sensor then rescan an image?

yes, don’t take object scans, take blank scans. then you’ll see ONLY the debris.

Not sure what that means exactly? If you mean that I need to scan a blank photo every X images, maybe that would work for the future, but I have thousands of scans already and need a simple way to see if I need to rescan any of them. It would take me days to rescan them all. If you meant that there is some way in OpenCV to check for blank space, I would be happy to look into that if you can give me some indication on how to do that

got a sample picture to look at?


Since these are family photos, I have removed the faces. I highlighted the error area with an ellipse and arrow. You can see that the line goes all the way through the image (it affects the removed area as well, and continues to the bottom of the image)

has that scan been rotated in any way? the streak isn’t going straight down.

All I would have done manually is 90 degree rotations. The software I use has the option to fix rotation issues which was likely selected, so the adf could have pulled it in at a slight angle and the software then corrected it

just to state the obvious, all that interference makes the task much harder.

it’s especially silly because whatever program did those things did nothing about the streaks.

Understood. I have seen that the software for newer hardware has an option to detect dirt, but it’s not available for my model. Even if it was available, it will not go back and check old scans. Is there something I can do to detect, or is it to complicated?

If I need to manually check old ones, I can accept that, but even for future scans, it would be great to have something, so if I didn’t have it correct for slightly skewed images, I would need to check for the streak and then correct the skew, so if that is something opencv could do then I would try that