FFT Filtering, Part II

This example was contibuted by Gilles Carpentier, Faculté des Sciences et Technologies, Université Paris 12 Val de Marne.

Original Image

This is the original 256x256 image cropped from the composite picture on the FFT Filtering page. It will be the initial image for the tests.

Enhanced FFT of Image

This is the power spectrum of the original image, enhanced by Process>Math>Gamma (4) and Image>Adjust>Brightness/Contrast (Auto). The artifacts representing the horizontal streaks are easily visible along the y axis. Note the difference between this image and the following.

FFT of Image

Power spectrum of the original image with a mask composed of two 5x80 pixel bars centered on the y axis spectra.

Inverse FFT of Image

The inverse FFT of the previous image, with the horizontal streaks removed and the image details preserved.

Here is macro that automates this procedure:

run("FFT");
setColor(0);
makeRectangle(125, 0, 5, 80);
fill();
makeRectangle(125, 176, 5, 80);
fill();
run("Inverse FFT");

Here is alternative macro that uses the Process/FFT/Custom Filter command instead of Process/FFT and Process/Inverse FFT:

id = getImageID;
width = getWidth;
height = getHeight;
run("New...", "name=Filter type=8-bit fill=White width="+width+" height="+height+" slices=1");
setColor(0);
makeRectangle(124, 0, 7, 80);
fill();
makeRectangle(124, 176, 7, 80);
fill();
run("Select None");
run("Gaussian Blur...", "radius="+3);
selectImage(id);
run("32-bit"); // convert to float
run("Custom Filter...", "filter=Filter");
run("8-bit"); // convert back to 8-bits
And here is macro that removes the streaks using the Process/FFT/Bandpass Filter command:
run("Bandpass Filter...", "filter_large=256 filter_small=0 suppress=Horizontal tolerance=5");
The FFTRemoveStreaks macro can also be used to remove horizontal streaks (try %=0.3 and sd=0.8):
rsb.info.nih.gov/ij/macros/FFTRemoveStreaks.txt

| Examples | Home