In this part we will attempt to enhance a finger print from what we have learned about the Fourier Transforms(FT) of 2D patterns.
Given a fingerprint pattern...
Given a fingerprint pattern...
Figure 1: Finger print pattern
from: ref:www.vosizneias.com/.../2009/02/fingerprint.jpg
from: ref:www.vosizneias.com/.../2009/02/fingerprint.jpg
We take its FT...
Figure 2: FT of finger print pattern
Question: How do we know which part of the FT we need and which are the parts we need to get rid of?
I have chosen a Gaussian filter to select the part of the FT I want to retain...
Question: How do we know which part of the FT we need and which are the parts we need to get rid of?
Answer: From what we have learned from past activities, we know that the FT of a periodic pattern is a pair of dirac deltas. Since our image is a finger print pattern, we can see that the periodic pattern is along every direction. From here we can conclude that the ring like structure at the center is the part of the FT that we want to retain. :D and ofcourse the center pixel since this corresponds to the background of the image.
I have chosen a Gaussian filter to select the part of the FT I want to retain...
Figure 3: A Gaussian Filter
Multiply the FT of the fingerprint pattern with the Gaussian filter I have created, leaving only the ring-like shape at the center and the background (center of the FT).
Figure 4: FT multiplied by the filter
Taking the inverse of Figure 4 results to the figure below. This is an enhanced fingerprint pattern...
Figure 5: Enhanced finger print pattern
Taking the inverse of Figure 4 results to the figure below. This is an enhanced fingerprint pattern...
Figure 5: Enhanced finger print pattern
CODE:
I = imread('C:\Users\cindyleen\Desktop\1st sem classes\186\a8\8b\fingerprint.jpg');
ffti = fft2(I);
li = log(abs(fftshift(ffti)));
ni = (li - min(li))/(max(li) - min(li));
//imshow(ni, []);
imwrite(ni, 'C:\Users\cindyleen\Desktop\fftfingerprint.bmp');
//gaussian filter
var1 = 0.1;
var2 = 1;
var3 = 7;
[a b] = size(ni);
x = linspace(-10, 10, b);
y = linspace(-10, 10, a);
[X Y] = meshgrid(x, y);
g = exp(-(X.^2 + Y.^2)./var1)-(exp(-(X.^2 + Y.^2)./var2)) + (exp(-(X.^2 + Y.^2)./var3));
ng = (g - min(g))./(max(g) - min(g));
//imshow(ng, []);
imwrite(ng, 'C:\Users\cindyleen\Desktop\filter.bmp');
mi = ffti.*fftshift(ng);
mi2 = ni.*ng;
mn = (mi2 - min(mi2))/(max(mi2) - min(mi2));
imshow(mi2, []);
imwrite(mn, 'C:\Users\cindyleen\Desktop\filterfft.bmp');
//take the fft
invft = abs(fft(mi));
in = (invft - min(invft))/(max(invft) - min(invft));
imshow(invft, []);
imwrite(in, 'C:\Users\cindyleen\Desktop\filter.bmp');
Grade: 10/10
Thanks Rap-rap!
I = imread('C:\Users\cindyleen\Desktop\1st sem classes\186\a8\8b\fingerprint.jpg');
ffti = fft2(I);
li = log(abs(fftshift(ffti)));
ni = (li - min(li))/(max(li) - min(li));
//imshow(ni, []);
imwrite(ni, 'C:\Users\cindyleen\Desktop\fftfingerprint.bmp');
//gaussian filter
var1 = 0.1;
var2 = 1;
var3 = 7;
[a b] = size(ni);
x = linspace(-10, 10, b);
y = linspace(-10, 10, a);
[X Y] = meshgrid(x, y);
g = exp(-(X.^2 + Y.^2)./var1)-(exp(-(X.^2 + Y.^2)./var2)) + (exp(-(X.^2 + Y.^2)./var3));
ng = (g - min(g))./(max(g) - min(g));
//imshow(ng, []);
imwrite(ng, 'C:\Users\cindyleen\Desktop\filter.bmp');
mi = ffti.*fftshift(ng);
mi2 = ni.*ng;
mn = (mi2 - min(mi2))/(max(mi2) - min(mi2));
imshow(mi2, []);
imwrite(mn, 'C:\Users\cindyleen\Desktop\filterfft.bmp');
//take the fft
invft = abs(fft(mi));
in = (invft - min(invft))/(max(invft) - min(invft));
imshow(invft, []);
imwrite(in, 'C:\Users\cindyleen\Desktop\filter.bmp');
Grade: 10/10
Thanks Rap-rap!
No comments:
Post a Comment