0
$\begingroup$

This is quite an "applied" question, but I don't see any more appropriate StackExchange, so here it goes. My situation is the following:

  • I have a sizeable (> 40) set of images (photos) that have been scanned using a flatbed scanner.
  • Unfortunately, there was a "smudge" due to some item previously placed on the scanner. This smudge remained fixed for all the scans, since it was due to some small amount of translucent residue on the glass bed.
  • The photos may be rotated some multiple of 90 degrees and offset, but are otherwise exactly what was scanned (high-resolution TIFF images).

Would it be possible to extract the "smudge" (i.e., the equivalent of an image filter applied to the physical photo that results in the scanned image), and then apply the inverse of this filter to all my images (with appropriate rotation and offset)? I don't know if tools already exist that could do this, but any guidance as to algorithms/approaches would be much appreciated.

$\endgroup$
  • $\begingroup$ If you obtain an "empty" scan, this would give you the pattern which you can then subtract from the images (with a bit of pre-processing). No filtering is required for this. $\endgroup$ – A_A Jan 28 at 11:04
  • $\begingroup$ @A_A Thanks for the idea. I thought of this too, but unfortunately I have no access to this any more. Realised far too late... $\endgroup$ – Noldorin Jan 29 at 3:22
1
$\begingroup$

Would it be possible to extract the "smudge" (i.e., the equivalent of an image filter applied to the physical photo that results in the scanned image), and then apply the inverse of this filter to all my images (with appropriate rotation and offset)?

It is difficult to reply Yes or No to this question. The results depend very much to what you are working with and for what purpose.

There are two things that are happening here:

  1. The smudge absorbs some light
  2. The smudge refracts and scatters some light

Dealing with 1 is easier than dealing with 2. Light is absorbed and therefore the smudge leaves behind it a shadow. If you had a "mask" of how much light passes through each point of the smudge, then you could get rid of it by adjusting the image pixel values (i.e. the comment suggestion).

If the smudge is caused by a deposit (e.g. finger markings, droplets, gel, etc) then it not only has diminished the light that went through it, it also has changed its path. Therefore, even if you correct the shadow, the "focus shadow" will still be there.

It is exactly like having an extra lens on top of the existing focusing mechanism.

This second bit could be corrected with a "filter", but it's easier said than done.

The main problem here is that you will not be able to recover an exact "image" of the smudge, so that you can then invert it. This is even worse if the smudge has been changing slightly with every image acquisition.

Short of obtaining an "empty" scan, you could try to obtain the average frame over N (grayscale) images. This is assuming that the N images have the smudge at exactly the same position. If not, then you will have to align them.

If N is high enough (at least 20 but it depends on image content too) then you will start to see the smudge shape over a (mostly) average background.

This can be used to diminish the shadow (at least) or deconvolve the affected regions to diminish the "focus shadow" too.

But, whether this is successful also depends on the use of the images. If you had to do measurements on the affected pixels, or look for patterns, this filtering operation could distort your results.

I don't know if tools already exist that could do this, but any guidance as to algorithms/approaches would be much appreciated

These operations can be applied with low level image processing tools (e.g. Octave or skimage ) but for a quick test you could use:

  • Hugin to align the images

  • Gimp to stack the (aligned) images (in layers) and obtain the average image that would reveal the smudge.

The deconvolution bit is a bit more involved. There is ImageJ which has an astrophotography plugin that would be very similar to your use case except that in astrophotography the "smudge" is assumed symmetric and spatially invariant (same across the image)....which yours might not be. There are however other plugins you might find useful in this.

Hope this helps.

(If a subset of the images could be shared, we could have a quick go at it).

|improve this answer|||||
$\endgroup$
  • $\begingroup$ A very thorough answer, thank you! Indeed I fear 2 may be the case, which is a major pain, although not completely impossible it seems. Anyway, this should be enough information to me to go forwards. $\endgroup$ – Noldorin Jan 29 at 23:25
  • 1
    $\begingroup$ @Noldorin Glad you found this helpful, all the best for the project $\endgroup$ – A_A Jan 30 at 10:08

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.