Cleaning of scanned photo overlaid with pattern


#1

Hi all,

recently a photographer came to my son’s kindergarten and did portraits and group shots. For a reasonable fee, we got prints of the images and download links for the portraits (of course only the pictures of our son). However, the group photo was only available as a medium sized print. I guess this decision is about law and stuff, so there’s nothing to do about that. Since I want to include the group photo in a private photo book (just for the family), I scanned it. It turns out, that the photographer used a special paper for the prints that overlays a hive pattern. I once read that the purpose of this paper is copy protection.

I started trying to remove the pattern in the frequency domain, using G’MIC’s fourier transform. I expected a peak in every quadrant of the transformed image with comparatively high frequency, however, the full image shows many peaks that could contribute. Playing with it did not lead to a reasonable result. Next I tried the equalizer in darktable, but no success as well.

Do you have any ideas how to get rid of the pattern?


[Feature Request] FFT denoise
#2

@chris Apart from legal matters (i.e. are you allowed to include that photo in a book):
does your scanner have a de-screen option you can experiment with?


#3

I meant, a private photo book just for the family. Sorry for the imprecise description, here in Germany, the German word that literally translates from “photo book” is mainly used for private books such as album like books that are produced at low quantities, most of the time only a quantity of 1. For the kind of photo books that are sold in larger quantities (e.g. coffee table books), we have another word that would literally translate to “picture volume”.

What is a de-screen option? Is this on the hardware or software side?

Edit: I checked the term and it seems to be for removing Moire patterns from scans of printed material. My problem is clearly similar, and de-screen seems to be a software option and therefore similar techniques should work for my scanned image. However, “my” pattern is only similar and not the same as printer’s dot rasters, and probably there are possibilities that offer more control of the process than clicking a de-screen option. FLOSS solutions preferred :wink:


#4

I have photographs from the seventies printed on ‘satin’ paper that produces that effect, very difficult to fix. Rather than a scan, try a re-photograph with various light directions and pick the best.

Do not give up with FFT, it will probably fix the pattern but leave a ‘soft’ image that can be sharpened (but not a lot)

G’mic FFT is a little peculiar in operation, the regular one is more straight forward, however.

Constrain the FFT area with a selection. screenshot: http://i.imgur.com/DXrZxt2.jpg
Apply a radial gradient transparent to black (or color pick the very dark gray from a corner of the FFT) http://i.imgur.com/9u0Tl08.jpg
Kill the selection and apply the inverse FFT. http://i.imgur.com/i47Y5lN.jpg

If you are feeling brave, a very old video of mine on the subject https://youtu.be/30XaCfM2QGg - using Gimp 2.6 & g’mic


(Shreedhar Inamdar) #5

Wow. I learned a totally new trick today! I got rid of the pattern but got a very soft image as @rich2005 mentioned.


I first converted the .png to .jpg and then applied FFT. Removed all the oval bands near the cross section center point to get this.


(Pat David) #6

FFT is the right approach for this, it just may take a little time and patience to get the right frequencies and to suppress them well. Really just a matter of how important the photo is and how much time you have to spend… :slight_smile:

In the past I have tried clone-stamping the peaks using data from nearby - might be worth trying.


#7

@patdavid Would the methods you described in


i.e. the Stain removal part, be applicable here as well?

Have fun,
Claes


(Pat David) #8

@Claes, possibly, but wavelets will isolate particular frequencies, and the pattern may occur along with details you wish to keep. So you still end up with manually working around something more than you might like (also - the pattern likely exists across multiple frequencies).

At least an FFT will show repeating patterns very clearly (the spikes).

If you do need to operate on the larger frequencies, then it’s still pretty valid. :slight_smile:


#9

Basically what @rich2005 and @Claes said. What I would do personally is split details to separate details from residual. FFT edit on details then merge.

Here, I didn’t do any manual FFT edits. I only applied a global filter but the result is okay.


#10

More to study :slight_smile:

Have fun!
Claes


#11

Thank you all for your helpful replies. The tip that led to success eventually was the video in the post of @Claes. Before, I had tried to mask the peaks in the spectrum by cloning them out or using neutral grey (I mean, the one with the relative magnitude of 0.5), which never worked. I would never have come to the idea to mask them in black. I always thought the zero value would map to neutral gray, since this is what you always see when, e.g., DCT patterns are shown. And, since this is a baseband problem, I thought having zero at 0.5 would remove the need to store the sign information. It seems that the implementation is different or that the reason that it works is totally different ;-).

In the end, great success with this technique, I just masked out all peaks with a soft, round, black brush and the pattern is entirely gone, without affecting sharpness or colour or anything else.

However, working with the already downscaled scan at approx. 18 MP required a lot of patience with my i7 8 GB notebook, with several freezes during the transform. After I obtained the final result, and just before I was able to save, GIMP decided to crash. So let’s start again …

Nevertheless, thank you all again for all the extremely useful tips and hints :smile:.


#12

Late into the fray, but if the bumps are due to the side lighting by the scanner then:

  • Do 4 scans in the four orientations (moving the paper over the glass of course, not telling the software to rotate the output)
  • Load the 4 scans as layers in Gimp
  • Re-orient/align (“difference” mode is your friend)
  • Apply GMIC’s median filter.

#13

Unfortunately they aren’t dependent on the light direction. It is a paper made for copy protection, and the pattern removes parts of the image. However, recent tries with fourier transform look very promising, I was just not able to save before GIMP crashed, otherwise I would have already shown you an example. Now I have to wait for my next free time slot.


#14

I wrote a tutorial on what I did in post #9, which I may make more official if there is a demand for it. Actually, it is a more refined version, so the result should be much better than the one in post #9. Come to think of it, the tutorial might be more suitable for this thread…