7.5 Consider an image that is black except for a single pixel wide stripe from t
ID: 3596305 • Letter: 7
Question
7.5 Consider an image that is black except for a single pixel wide stripe from the top left to the bottom right (Fig. E7.1, top left). Can you explain its Fourier transform (Fig. E7.1, bottom left)? Also, consider an image ofnoise (Fig. E7.1, top right), i.e. every pixel has a random value, independent of all other pixels. Can you explain its Fourier transform (Fig. E7.1, bottom right)? What does the bright spot in the middle of the noise Fourier transform image represent? Why does the Fourier transform of the noise appear dark gray? Fiure E Stripe and noise, and their Fouricr transforms. What is the result of performing a Fourier transform on the Fourier transform of an image? Try it out. Can you explain the result?Explanation / Answer
Now we start to illustrate the use of some filters on the girl image. The first is a lowpass filter. The upper left is the original image. The lower left is produced by:
fft2d 128 < girlimage > girlfft
mag2d 128 < girlfft > girlmag
The lower right is then produced by:
fftfilt 128 low ideal 50 < girlfft > lpgirlfft
mag2d 128 < lpgirlfft > lpgirlmag
Finally, the upper right is produced by:
ifft2d 128 < lpgirlfft > lpgirl
To see the results:
The left side of the image we have seen before. In the lower right, notice how sharply the high frequencies are cut off by the "ideal" lowpass filter. Notice also that not very much power is being thrown away beyond the circle that is cut off. In the upper right, the reconstructed image is obviously blurrier due to the loss of high frequencies. Overall contrast is still pretty good due to that fact that not too much power was thrown away. Notice also that there are obvious "ringing" artifacts in the reconstructed image. This is due to the very sharp cutoff of the "ideal" filter. A Butterworth or Exponential filter with reasonably low order would not cause these.
Now we will do a highpass filter. The following image is produced in the same way as the previous one except:
fftfilt 128 high butter 50 < girlfft > hpgirlfft
In other words, a butterworth filter of 1st order is used.
Notice in the lower right that this filter does not cut off sharply at the 50% point as the lowpass did. However, the center bright spot, which accounts for most of the power in the image, is clearly gone. The image in the upper right, which looks totally black, in fact is not totally black. If you use the colormap capability of "dym" to stretch the gray values from 0-20 out over the entire range, you can see that this highpass filter has preserved the image information where there are very rapid changes in gray level. Such a process is frequently what is desired in an edge detector. However, it is not an improvement in the image. There are 2 problems. First, it is too dark. This can be fixed by rescaling or re-contrast- stretching the image after filtering. This is commonly done and is easy. Second, and harder, is the fact that too much of the low frequency tonal information is gone.
Image sharpening requires a "sharpening" filter or high frequency emphasis filter. This kind of filter preserves some of the low frequency information but relatively boosts the higher frequencies. To do such a thing, we will construct our own filter which will be piecewise-linear. The filter will be circularly symmetrical and will have coefficients as follows:
0 0.5
96 4.0
127 4.0
In other words, Fourier coefficients of frequency-distance 0 from the origin will be multiplied by 0.5. As you go away from the origin or zero frequency, out to frequency-distance 96, the multiplier will be interploated between 0.5 and 4.0. From then outward, the multiplier will be 4.0. So higher frequency coefficients are multiplied by values greater than 1.0 and lower frequency coefficients are multiplied by values less thatn 1.0. The overall net effect on the image power is that it is unchanged. The above values are in a file called "filter_coeffs". To apply the filter, the following steps are carried out:
filttabler < filter_coeffs > filter_file
fftfilt 128 file filterfile < girlfft > mfgirlfft
The rest of the image is constructed as before. To see the result Notice the relative brightness at high frequencies in the lower right image
Portraits are one of the few contradictions to the general principal that sharper is better.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.