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:
- The smudge absorbs some light
- 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:
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).