Filtering in Fourier Space "Unwanted repetitive patterns in an image can be removed by masking their
frequencies in the Fourier domain. Alternatively, desired frequencies in the image
may also be enhanced."
A Convolution Theorem
Figure 1.Results for steps 1 to 3.
Figure 2. Variance
As you vary the variance the FT intensity changes in such a way that increasing the variance increase the radius of the FT.
Fig 3. Inversion
To invert the gaussian dots such that highest becomes 0, lowest becomes 255
or 1.0 , I just multiplied the original values by -1 *255 and then added 255.
B. Fingerprints : Ridge Enhancement
Fig 4. The problem
After converting the image to grayscale, I took the FFT and from here try to create a mask to remove the frequencies of the blotches which is ... unknown.
So what I did is start by removing the higher frequencies...obviously using a circular aperture didnt work as seen in Fig.5.
Fig 5. Removing the higher frequencies with a circular aperture... didnt work
Next I tried the other way around, I didnt mask the higher frquencies but just retained it, then I tried cleaning the frequencies close the center as shown in Fig 6 until I finally tried creating a mask from the FT and just clean the FT as shown in Fig 7. The final almost cleaned finger print is shown in Fig 6 (last).
Figure 5.
Figure 6.
before(original fingerprint)
after-the enhanced fingerprint with ridges more clear and less blotches. This final image is from Figure 6c.
C. Lunar Landing Scanned Pictures : Line removal Remove the vertical lines in the image by filtering in the Fourier Domain.
Fig 7. Lunar image with vertical lines
a. b.
Fig 8. a.FT and horizontal mask to remove the vertical lines. b. the FFT of thw masked FT, the final image is inverted with no more vertical lines.
Fig. 9. The final cleaned image after rotation.
D Canvas Weave Modeling and Removal
Fig. 10 The canvas with weave pattern
Fig 11. The graycale of canvas image
Figure 12.FT of the image
Fig 12. Tried a combination of gaussian filtering and masking the regions shown in c... didint work , the resulting image in e was too blurred.
Figure 13. Made a mask that removes the symmetric peaks around the center.
The mask in figure 13 b, removed the frequencies of the weave pattern and a cleaned image is retrieved by taking the FT again. Also, the cleaned image has higher contrast such that the brushstrokes are enhanced.
Fig. 14. The unwanted canvas weave pattern is now removed(im from Fig 13 c).
Fig. 14. The inverted mask of the peaks
Fig. 15. The FT of inverted mask. It does look like the canvas weave pattern.
A .Familiarization with FT of different 2D patterns
Figure 1. a FFT of a circle, b. shifted FFT and c. FFT of FT resulting to the same circle.
Figure 2.
For Fig.2, the images above starting from the left are namely, an annulus, a square, square annulus, 2 slits and 2 dots all representing what we call apertures. The images on the bottom are their corresponding FT which is an Airy pattern for the annulus, a sinc function for the square apertures, double slit diffraction of maxima and minima in the horizontal axis for the vertical slits ans the sinusoid for the two dots.
a. b. c. d.
Figure 3. Comparison of a circular annulus and square annulus.
As expected the we have the a Airy pattern for a,b and a sinc function for c,d.
From these results we can say that the size of the aperture determines the intensity of the resulting diffraction pattern. It can be seen that the smaller the aperture is the brighter or more intense the FT or diffraction pattern is.
Figure 4. Variation in the dot size or pinhole radii
IT is shown in Fig.3 that the FT of 2 dots is a superposition of the FT of 2 small dots and FT of a circular aperture.
B Anamorphic property of the Fourier Transform
Anamorphic means something like producing different imaging effects along mutually perpendicular radii. We can see these in FT of perpendicular sinusoid signals.
Figure 5. Increase in the frquency
Increasing the frequency of the signal(sinusoid) resulted to the increase in the separation of the dots.We see here that the two dots corresponding to the frquency peaks shifted farther and father from the center, such that the lower the frequency the closer it is to the center while farther at higher frequency. The same with interferograms ,the spacing between the peaks of the FT of the signal gives corresponding frequency of the signal.
Fig.6 Effect of biasing
For a sinusoid of constant frequency and orientation, we expect that the peaks of the FT to remain the same since and it did and the position of the peaks did not vary. However the intensity of the dots was observe to change such that at low biasing the outer peaks were brighter and reduced at higher biasing which made (m=0) the central maximum peak brightest.
Fig.7
Since adding or subtracting the bias didn’t affect position of the peaks of the FT of the signal , we can just to choose to add the bias . For frequency=4, bias=0.1,1,10,100 was added to the sine wave and the resulting FT of the signal show that the only the intensity of the peaks varied and not the spacing.
Fig. 8
Rotating the signal(sinusoid) by an angle results to the rotation of the peaks of the FT.
Fig. 9
Top image shows thepatternand belowisits Fourier transform .Nowthe combination of these sinusoids in X and Y with the formula
z = sin(2*%pi*4*X).*sin(2*%pi*4*Y);
has a FT that is again symmetric about the center and with peaks that correspond to the frequency of each sinusoid in their respective axis. Thecombined signal had the same frequency as illustrated in their perfect symmetry but once we changed one of the frequency of the signals, say in the X axis,
z4 = sin(2*%pi*8*X).*sin(2*%pi*4*Y);
the x separation in the vertical orientationincreased. Werecallthatthehigherthefrequencythefartherthepeakfromthe center.
Fig 10
Addition of the combined sinusoids in the X and Y axis to 2 rotated sinusoids (theta=40,60deg)resulted to the image illustrated on top. Below is its FT which by inspection, is just the sum of the FT of each signal. The FT is thus useful for decomposing the frequency component in sampled signals.
The histogram of a grayscale image is equal to the graylevel probability
distribution function (PDF) if normalized by the total number of pixels. As such,
the grayscale PDF of an image can be modified in the same way one can modify
the PDF of random numbers.
Histogram manipulation is one way of improving the quality of an image,
enhancing certain image features, or mimicking the response of different imaging
systems, such as the human eye.
Given the cumulative distribution function (CDF) of a desired PDF, the grayscale
PDF of an image can be modified by backprojecting the grayscale values using
the CDF. Then
newly encountered functions in scilab:
tabul - frequency of values of a matrix or vector
tabul allows
you to compute the frequency of of occurence of a vector or matrix
[m]=tabul(X [,order])
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
•Activity 4: •Two categories of image enhancement techniques include spatial and frequencydomain techniques. Spatial techniques involve direct manipulation of image pixels while frequency domain techniques works by manipulation of fourier of the and wavelet transform of a signal. •Here, the spatialtechnique will used by way of histogram enhancement. The histogram of an image illustrate thedistribution of gray levels in the image in the range 0 to 255 where 0 is black and 255 is white and normalized when in the range [0.0, 1.0]. •The method of histogram enhancement works by equalization.This is one of the ways in which it can be done in Scilab: •You get the histogram of the image by using the tabul(filename, ‘i’) command that gives the frequency of occurrence of the matrix or vectors, or in this case the no. of pixels having that graylevel and then plot it. •The histogram: •x axis for the graylevel • y axis for the frequency value • •Next, normalize the greylevel and you distribute the frequency over the total no. of pixels and thus spread out the most frequent intensity values.
Results and discussions:
Using linear method of histrogram equalization, we see in Fig.1 that the resulting new image has a well distributed histogram as compared to the original image which has uneven probability distribution. The new image has a higher contrast than the original.
In Figure 2, using nonlinear histogram equalization using interp1(,,'linear') was used. However the resulting image has lower contrast than the original.
For this image the linear method was able to enhance the contrast in the image while the non linear method was not and only resulted to reduction in grayvalue of each graylevel.
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Code:
linear
im=imread('C:\Users\USA\Desktop\scilab and 186\grayscale parrot.png');