赞
踩
拖了许久才更新,这段时间太忙碌了。
前两步参考前文。
参考前文。
参考前文。
在 ( i , j ) (i,j) (i,j)位置的局部脊线的频率 f j , i f_{j,i} fj,i 被定义为: 在 ( i , j ) (i,j) (i,j)周围,与脊线方向 θ j , i \theta_{j,i} θj,i正交的方向,单位长度中有多少个脊线。为了简明扼要,我们假定一个指纹有一个恒定的频率,然后再去计算指纹中的局部的频率。
我们先看一下一个局部的例子:
region = fingerprint[10:90,80:130]
show(region)
计算这个并不复杂,简而言之就是计算落到X方向上的像素大小去区分. 大概意识是如下图:
我们计算一个叫做x-signature 的东西,定义为:
x-signature : 两个连续的峰值之间的像素的平均值。具体可以参考:
L. Hong, Y. Wan and A. Jain, “Fingerprint image enhancement: algorithm and performance evaluation,” in IEEE tPAMI, Aug. 1998
在开始计算之前,首先平滑图像,然后再在Y轴上累加np.sum(smoothed, 1),得到x-signature:
# before computing the x-signature, the region is smoothed to reduce noise
smoothed = cv.blur(region, (5,5), -1)
xs = np.sum(smoothed, 1) # the x-signature of the region
print(xs)
%
[10697 10796 11245 11970 12058 11508 10815 10064 9314 9125 9707 10389
10912 11370 11564 11116 10419 9916 9532 9250 9370 9833 10348 10899
11430 11429 11180 10773 10152 9409 9243 9351 9847 10620 11430 11482
11147 10536 9791 9010 8966 9337 9845 10431 10986 11071 10877 10416
9732 9264 9514 9946 10642 11353 11533 11050 10398 9649 9345 9636
10183 10614 10849 10646 10197 9827 9762 9908 10237 10529 10628 10437
10203 10011 10108 10364 10658 10828 10986 11106]
我们可以可视化x-signature看看到底是什么样子的:
x = np.arange(region.shape[0])
f, axarr = plt.subplots(1,2, sharey = True)
axarr[0].imshow(region,cmap='gray')
axarr[1].plot(xs, x)
axarr[1].set_ylim(region.shape[0]-1,0)
plt.show()
可以在右图看到我们有9个左右的峰值。左边指纹图也可以数一下,大概也是9个指纹条纹。我们找到局部指纹的最大的x-signature的index是多少,也就是在图片中的位置吧
# Find the indices of the x-signature local maxima
local_maxima = np.nonzero(np.r_[False, xs[1:] > xs[:-1]] & np.r_[xs[:-1] >= xs[1:], False])[0]
再次可视化看看:
x = np.arange(region.shape[0])
plt.plot(x, xs)
plt.xticks(local_maxima)
plt.grid(True, axis='x')
plt.show()
计算两个连续的峰值之间的距离
# Calculate all the distances between consecutive peaks
distances = local_maxima[1:] - local_maxima[:-1]
print(distances)
# [10 10 11 10 9 8 8]
也就是这样:
然后,根据这个距离,去估计脊线的周期频率:
10 + 10 + 11 + 10 + 9 + 8 + 8 7 = 9.428 \frac{10+10+11+10+9+8+8}{7} =9.428 710+10+11+10+9+8+8=9.428
# Estimate the ridge line period as the average of the above distances
ridge_period = np.average(distances)
print(ridge_period)# 9.428571428571429
以上则是如何计算局部脊线的频率的详细过程。
Charles@Shenzhen, 20210304
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。