%--------------------------------------------------------------------------
%fft_enhance_cubs
%enhances the fingerprint image
%syntax:
%[oimg,fimg,bwimg,eimg,enhimg] = fft_enhance_cubs(img)
%oimg - [OUT] block orientation image(can be viewed using
% view_orientation_image.m)
%fimg - [OUT] block frequency image(indicates ridge spacing)
%bwimg - [OUT] shows angular bandwidth image(filter bandwidth adapts near the
% singular points)
%eimg - [OUT] energy image. Indicates the 'ridgeness' of a block (can be
% used for fingerprint segmentation)
%enhimg- [OUT] enhanced image
%img - [IN] input fingerprint image (HAS to be of DOUBLE type)
%Contact:
% ssc5@cubs.buffalo.edu sharat@mit.edu
% http://www.sharat.org
%Reference:
%1. S. Chikkerur, C.Wu and V. Govindaraju, "Systematic approach for feature
% extraction in Fingerprint Images", ICBA 2004
%2. S. Chikkerur and V. Govindaraju, "Fingerprint Image Enhancement using
% STFT Analysis", International Workshop on Pattern Recognition for Crime
% Prevention, Security and Surveillance, ICAPR 2005
%3. S. Chikkeur, "Online Fingerprint Verification", M. S. Thesis,
% University at Buffalo, 2005
%4. T. Jea and V. Govindaraju, "A Minutia-Based Partial Fingerprint Recognition System",
% to appear in Pattern Recognition 2005
%5. S. Chikkerur, "K-plet and CBFS: A Graph based Fingerprint
% Representation and Matching Algorithm", submitted, ICB 2006
% See also: cubs_visualize_template
%--------------------------------------------------------------------------
function [oimg,fimg,bwimg,eimg,enhimg] = fft_enhance_cubs(img)
global NFFT;
NFFT = 32; %size of FFT
BLKSZ = 12; %size of the block
OVRLP = 6; %size of overlap
ALPHA = 0.4; %root filtering
RMIN = 5; %min allowable ridge spacing
RMAX = 20; %maximum allowable ridge spacing
do_prefiltering = 1;
[nHt,nWt] = size(img);
img = im2double(img); %convert to DOUBLE
nBlkHt = floor((nHt-2*OVRLP)/BLKSZ);
nBlkWt = floor((nWt-2*OVRLP)/BLKSZ);
fftSrc = zeros(nBlkHt*nBlkWt,NFFT*NFFT); %stores FFT
nWndSz = BLKSZ+2*OVRLP; %size of analysis window.
warning off MATLAB:divideByZero
%-------------------------
%allocate outputs
%-------------------------
oimg = zeros(nBlkHt,nBlkWt);
fimg = zeros(nBlkHt,nBlkWt);
bwimg = zeros(nBlkHt,nBlkWt);
eimg = zeros(nBlkHt,nBlkWt);
enhimg = zeros(nHt,nWt);
%-------------------------
%precomputations
%-------------------------
[x,y] = meshgrid(0:nWndSz-1,0:nWndSz-1);
dMult = (-1).^(x+y); %used to center the FFT
[x,y] = meshgrid(-NFFT/2:NFFT/2-1,-NFFT/2:NFFT/2-1);
r = sqrt(x.^2+y.^2)+eps;
th = atan2(y,x);
th(th<0) = th(th<0)+pi;
w = raised_cosine_window(BLKSZ,OVRLP); %spectral window
%-------------------------
%FFT Analysis
%-------------------------
for i = 0:nBlkHt-1
nRow = i*BLKSZ+OVRLP+1;
for j = 0:nBlkWt-1
nCol = j*BLKSZ+OVRLP+1;
%extract local block
blk = img(nRow-OVRLP:nRow+BLKSZ+OVRLP-1,nCol-OVRLP:nCol+BLKSZ+OVRLP-1);
%remove dc
dAvg = sum(sum(blk))/(nWndSz*nWndSz);
blk = blk-dAvg; %remove DC content
blk = blk.*w; %multiply by spectral window
%--------------------------
%do pre filtering
%--------------------------
blkfft = fft2(blk.*dMult,NFFT,NFFT);
if(do_prefiltering)
dEnergy = abs(blkfft).^2;
blkfft = blkfft.*sqrt(dEnergy); %root filtering(for diffusion)
end;
fftSrc(nBlkWt*i+j+1,:) = transpose(blkfft(:));
dEnergy = abs(blkfft).^2; %----REDUCE THIS COMPUTATION----
%--------------------------
%compute statistics
%--------------------------
dTotal = sum(sum(dEnergy));%/(NFFT*NFFT);
fimg(i+1,j+1) = NFFT/(compute_mean_frequency(dEnergy,r)+eps); %ridge separation
oimg(i+1,j+1) = compute_mean_angle(dEnergy,th); %ridge angle
eimg(i+1,j+1) = log(dTotal+eps); %used for segmentation
end;%for j
end;%for i
%-------------------------
%precomputations
%-------------------------
[x,y] = meshgrid(-NFFT/2:NFFT/2-1,-NFFT/2:NFFT/2-1);
dMult = (-1).^(x+y); %used to center the FFT
%-------------------------
%process the resulting maps
%-------------------------
for i = 1:3
oimg = smoothen_orientation_image(oimg); %smoothen orientation image
end;
fimg = smoothen_frequency_image(fimg,RMIN,RMAX,5); %diffuse frequency image
imshow(fimg,[]);
cimg = compute_coherence(oimg); %coherence image for bandwidth
imshow(cimg,[]);
bwimg = get_angular_bw_image(cimg); %QUANTIZED bandwidth image
imshow(bwimg,[]);
%-------------------------
%FFT reconstruction
%-------------------------
for i = 0:nBlkHt-1
for j = 0:nBlkWt-1
nRow = i*BLKSZ+OVRLP+1;
nCol = j*BLKSZ+OVRLP+1;
%--------------------------
%apply the filters
%--------------------------
blkfft = reshape(transpose(fftSrc(nBlkWt*i+j+1,:)),NFFT,NFFT);
%--------------------------
%reconstruction
%--------------------------
af = get_angular_filter(oimg(i+1,j+1),bwimg(i+1,j+1));
rf = get_radial_filter(fimg(i+1,j+1));
blkfft = blkfft.*(af).*(rf);
blk = real(ifft2(blkfft).*dMult);
enhimg(nRow:nRow+BLKSZ-1,nCol:nCol+BLKSZ-1)=blk(OVRLP+1:OVRLP+BLKSZ,OVRLP+1:OVRLP+BLKSZ);
end;%for j
end;%for i
%end block processing
%--------------------------
%contrast enhancement
%--------------------------
enhimg =sqrt(abs(enhimg)).*sign(enhimg);
enhimg =imscale(enhimg);
enhimg =im2uint8(enhimg);
%--------------------------
%clean up the image
%--------------------------
emsk = segment_print(enhimg,0);
enhimg(emsk==0) = 128;
%end function fft_enhance_cubs
%-----------------------------------
%raised_cosine
%returns 1D spectral window
%syntax:
%y = raised_cosine(nBlkSz,nOvrlp)
%y - [OUT] 1D raised cosine function
%nBlkSz - [IN] the window is constant here
%nOvrlp - [IN] the window has transition here
%-----------------------------------
function y = raised_cosine(nBlkSz,nOvrlp)
nWndSz = (nBlkSz+2*nOvrlp);
x = abs(-nWndSz/2:nWndSz/2-1);
y = 0.5*(cos(pi*(x-nBlkSz/2)/nOvrlp)+1);
y(abs(x)<nBlkSz/2)=1;
%end function raised_cosine
%-----------------------------------
%raised_cosine_window
%returns 2D spectral window
%syntax:
%w = raised_cosine_window(blksz,ovrlp)
%w - [OUT] 1D raised cosine function
%nBlkSz - [IN] the window is constant here
%nOvrlp - [IN] the window has transition here
%-----------------------------------
function w = raised_cosine_window(blksz,ovrlp)
y = raised_cosine(blksz,ovrlp);
w = y(:)*y(:)';
%end function raised_cosine_window
%---------------------------------------------------------------------
%get_angular_filter
%generates an angular filter centered around 'th' and with bandwidth 'bw'
%the filters in angf_xx are precomputed using angular_filter
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
指纹识别完整程序代码.rar (73个子文件)
main.m 943B
thinning.m 1KB
rotate.m 536B
a.m 1009B
6.bmp 65KB
ce.asv 5KB
find_show_list.m 158B
thin4.m 2KB
Untitled.m 833B
thres.m 752B
is_branch.m 335B
a.mat 1KB
finger.m 475B
conv2fft.m 7KB
check_condition.m 1KB
n_sum.m 324B
separate.m 2KB
and_357.m 122B
fft_enhance_cubs.m 20KB
fenlei.m 6KB
is_single.m 360B
thinning7.m 3KB
thinning2.m 1KB
table1.m 221B
fenlei.asv 6KB
thinning3.m 4KB
adapt.m 961B
thinning5.asv 3KB
imtiqu.m 4KB
thinning4.m 920B
b.mat 2KB
minutie.m 99B
2.mif 663KB
5.bmp 65KB
7.bmp 65KB
2.bmp 192KB
end_track.m 2KB
1.bmp 192KB
rgb2gray.m 122B
thinning6.m 4KB
is_a_branch_point.m 323B
ce.m 5KB
thinning5.m 4KB
try.m 256B
1.mif 727KB
gui.asv 2KB
is_end.m 338B
4.bmp 192KB
branch_track.m 2KB
find_list.m 706B
trf.m 549B
b.m 1KB
and_157.m 127B
is_a_end_point.m 306B
thin.asv 329B
test.m 222B
go_to_next_element.m 732B
m_connect.m 382B
testread.m 304B
decorate.m 7KB
thinning3.asv 4KB
feat.m 10KB
youji.bmp 40KB
scanimage.m 303B
thinning4.asv 1KB
center.m 428B
thin.m 328B
3.BMP 116KB
gui.m 2KB
t_sum.m 547B
show_list.m 230B
find_next.m 2KB
match_end.m 2KB
共 73 条
- 1
资源评论
- wq5283829452015-04-21还不错,对我的学习有点帮助
- u0105032112014-05-05对特征匹配的课题有参考价值
- jinghongyijian2013-06-13对我的课程设计有点用
- Fourier17682015-06-13还可以,做指纹识别能参考下。
- cbl11149255782017-10-11在matlab上不能运行
zhchchzh_1212
- 粉丝: 1
- 资源: 1
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功