4

I scanned slides and I have now 48 bit color plus IR (infrared) 16 bit gray files. Now I am processing them to remove dust and scratches and I am looking for a way to batch-detect the correct threshold to apply to IR images to define the regions with dust and scratches. I have over 4k slides and I cannot check all of them manually.

My question is about the choice of an algorithm to define the IR threshold. Other similar questions (Healing dust and scratch marks in scanned photos in post-processing) do not mention the infrared layer, therefore they need to "guess" the dust and the scratches. With the IR channel I have, I know where the issues are, only I have to isolate them better.

I read other questions concerning removal of dust and scratches from scanned film, for example https://stackoverflow.com/questions/27217916/dust-and-scratch-removal-with-open-source-graphic-libraries but those are about the choice of algorithms for the healing, given an already-defined IR B/W mask.

I also prepared some examples to illustrate my issue, I hope they won't clutter the question too much.

By checking the histograms of the IR images of each roll, I notice that I can define a threshold that correctly marks only dust and scratches, without wrongly marking parts of the picture as dust, but this threshold is low and not every scratch gets marked. See first image. I found this is about 135/255, 53% gray.

However, in some images the IR data is distributed around higher brightness values and I would like to increase the threshold to detect more dust. See example 2 where I used either the same threshold as in the first example (first mask) or I used a threshold of 194/255=76% gray (second mask). However, I don't know how to define this new threshold, image by image, automatically.

An option would be to check the slope of the IR histogram? I'm not sure how, there is a lot of variability.

Another option would be to analyse sub-regions of each image and to define a threshold on each one of them to adapt the baseline to brighter and darker regions. However, I am not sure how to define such an algorithm.

I am using G'Mic for the processing due to the very good inpaint filter and it provides a built-in language interpreter. As long as I know which algorithm I should implement, I should have no further problems. This question is specifically about the algorithm and not about its implementation.

The suggestion of other software able to adaptively mark dust and scratches is also welcome, I could pass the result to G'Mic for the final inpaint/healing.

Example 1 Example 2

  • I added some more examples (IR images and histograms) to this OneDrive shared folder: 1drv.ms/1GV1YDn – FarO Jul 27 '15 at 17:32
  • 1
    Can you make the title of this question actually be a concise summary of the question, in question form? Thanks! – mattdm Aug 4 '15 at 13:31
  • The easiest way to eliminate the dust spots is to clean the slides/negatives before you scan them. That's what pec^pads are created to do. – Michael C Jan 7 '16 at 17:52
  • 2
  • 1
    It's different, I edited my question to clarify. – FarO Jan 8 '16 at 12:56
2

A possible algorithm for better isolate the dust and scratches is explained in Comprehensive Solutions for Removal of Dust and Scratches from Images and in Manual Dirt/Scratch Removal Using Infrared Channel (archived version, text-only).

The idea is to remove the shadow of the color information from the infrared image by using the red channel (the one with the wavelength closest to IR) by either simple division of the IR channel by the red channel (second link) or by using linear regression and decorrelation (first link).

At that point the image should be almost clean of the color data and contain almost only defects. Setting a constant threshold becomes feasible.

  • Too bad the second link does not work anymore. If you have the PDF and if it is redistributable, please share it somewhere. – TFuto Jan 13 '16 at 14:59
  • Updated the answer with a link to text-only version. – FarO Jan 13 '16 at 15:12
  • 1
    I tried to use linear correlation to remove the contribution of the visible (or only of the red) channels from the IR image and the results are basically perfect. – FarO Jan 21 '16 at 9:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.