Hacker News new | ask | show | jobs
by zokier 1269 days ago
I wonder what would be the more systematic approach than manually painting over the fft image? That constellation of peaks in fft should be reasonably easy to recognize (semi-)automatically, then you'd need to figure out good mask for those.. is it a circular blob, or maybe diamond/star shape? And what size is best? Etc etc.
3 comments

It has been a long time since I have done anything in this domain (20+ years), but if I understand correctly, the original article author is essentially filtering out high frequency signals by painting over the bright FFT spots, essentially creating a localized low-pass filter or maybe band-pass filter.

FFT essentially just transforms data into its frequency domain, so I assume the representation shown in the article is just that, brighter spots indicate higher frequency information (which would come from all the little spaced dots), so killing those essentially smooths the noise out of the data.

I imagine that the same effect could be automatically achieved by identifying which frequencies to filter out to get the desired effect.

I dont believe that by painting over the bright FFT spots you are necessarily removing the high frequencies. Instead, you are removing the strong frequencies from the image. The strong frequencies cause peaks in the FFT image. Its the repetitive nature of the moire effect that cause peaks in the FFT image.
Indeed, the frequencies get higher further away from the center of the FFT image with the center being the "DC" component of the signal. The brightness, as you note, correspond to the amplitude of a given frequency.

you can think of it as a polar plot where: radius = frequency, angle = angle (as in points along the horizontal direction in the FFT correspond to e.g. vertical stripes in the image), brightness = power

There is an imaginary part to the FFT that contains the phase-shifts needed to add everything back up into the original image. You may have noticed that the "FFT of the image" is symmetric, so something else should be needed to compute the inverse.

Ahhh, so perhaps the position indicates the frequency and the brightness indicates the magnitude of the frequency? That makes sense - in that case the atricle's approach feels more like you said, a manually applied band pass or comb filter, i.e. it either removes or attenuates signals within certain frequency ranges.
Another nice property of the FFT is that convolution in image space is multiplication in frequency space, so multiplying the FFT with an image of a Gaussian (or any other linear kernel such as an edge detector) is exactly equivalent to applying the filter on the original image.
Theoretically, you're attempting to remove the artifacts that were added back in by the halftone printing process and recover the original image. If you knew the exact noise spectrum that the halftone print added into the image, you could invert it. For example with some scans of halftone prints of known images, you could reconstruct that noise spectrum and remove it as best as possible. This would preserve, to your best ability, whatever high-frequency data existed in the original image.

If we were sure that the halftone resolution was smaller than the relevant details of the photo, then we could just use a low-pass filter (a circular aperture), removing all the high-frequency components from the halftone print, but keeping the details of the photo. However in this case, the photo has details that are at the same scale as the halftone.

So the next best thing is to try to infer the halftone noise spectrum and subtract it, which is hard because it's mixed in with the photo, and we don't know which spectral peaks are from the photo and which are from the halftone process. What we can guess is that the legitimate high-frequency information in the photo should be pretty random, meaning it will be smeared out across the fourier spectrum, while the halftone print will be strongly periodic - concentrated into dots that are nearly symmetrically distributed around the origin (with some radial pattern that depends on the print process), away from the low-frequency center point.

Based on this we guess that any big dots that are symmetrically placed around the origin are probably more halftone noise than image signal, and any grey areas between them are probably more real image data than noise. Then we fit a noise filter to the dots with a regression, doing our best guess to invert the noise, bringing the whole high-frequency zone to approximately a uniform grey.

And then we hope that the picture isn't a photo of a herd of small spotted leopards.

I think I 'd start with simple generated images first, like a sine wave rendered with dots, to get some initial insights.