circle
smaller circle Image above(clockwise from top left): original image; FFT of image; shifted FFT of image; original image with FFT applied twice.
I = imread('circle.bmp');
Igray = im2gray(I);
FIgray = fft2(Igray); //FIgray is complex
scf(1);
Image above(clockwise from top left): original image, FFT of image; image after applying FFT twice; shifted FFT of image.(The inverted image was scaled .)
*Simulation of an imaging device
a=imread('C:\MyDocuments\AP186\VIP.bmp');
rgray = im2gray(r);
agray = im2gray(a);
Fr = fftshift(rgray);//aperture is already in the Fourier Plane and need not be FFT'ed
Fa = fft2(agray);
FRA = Fr.*(Fa);
IRA = fft2(FRA); //inverse FFT
FImage = abs(IRA);
imshow(FImage, [ ]);
Using this code, the following images were produced:
Image above(clockwise from top left): original image; convolved image using circle image; convolved image using smaller_circle image; convolved image using smallest_circle image.
As we can see, as the circle being used gets smaller, the quality of the image becomes lesser.
*Template matching using correlation
r=imread('C:\MyDocuments\AP186\text.bmp');
a=imread('C:\MyDocuments\AP186\A.bmp');
rgray = im2gray(r);
agray = im2gray(a);
Fr = fftt2(rgray);
Fa = fft2(agray);
b = conj(Fr);
FRA = (Fa).*b;
IRA = fft2(FRA);
FImage= abs(IRA);
imshow(FImage, [ ]);
With this code, the originial image became unrecognizable. The texts in the image looked like letters A.
*Edge detection using convolution integral
pattern = [-1 -1 -1; 2 2 2; -1 -1 -1];
a=imread('C:\MyDocuments\AP186\VIP.bmp');
image = imcorrcoef(a, pattern);
imshow (image, []);
Using the code, the following images were formed. The first image shows a horizontal pattern since the pattern used here is also horizontal. The second image used a vertical pattern hence the image of VIP followed that pattern. It's also the same with the 3rd image, this time a spot pattern was used.
Acknowledgements: Jorge Presto
Grade: 10/10 - because the activity was well done.
No comments:
Post a Comment