0
私はOpenCVのとPythonを使って指紋 画像の方位マップを取得する機能を実現していますが、何かが間違っている実装は
def compute_real_orientation(array_I, w=17, h=17, low_pass_filter=cv2.blur,filter_size=(5,5),blur_size=(5,5),**kwargs):
row, col = array_I.shape
array_I = array_I.astype(np.float)
Ox = array_I[0:row-h+1:h,0:col-w+1:w].copy()
Ox[:] = 0.0
Vx = Ox.copy()
Vy = Vx.copy()
Oy = Ox.copy()
angle = Vx.copy()#array to contain all the 17*17 blocks's orientatons
c = r = -1
for i in xrange(0, row-h+1, h):
r+=1
for j in xrange(0, col-w+1, w):
c+=1
Dx = cv2.Sobel(array_I[i:i+h,j:j+w],-1,1,0)#gradient component x for a 17*17block
Dy = cv2.Sobel(array_I[i:i+h,j:j+w],-1,0,1)#gradient component y for 17*17 block
for k in range(0,h):
for l in range(0,w):
Vy[r][c] += ((Dx[k][l])*(Dy[k][l]))**2
Vx[r][c] += 2*(Dx[k][l])*(Dy[k][l])
angle[r][c] = 0.5*(math.atan(Vy[r][c]/Vx[r][c]))#get the orientation angle for the given 16*16 block
c = -1
#smoothing process of the whole array angle
row, col = angle.shape
for i in range(0, row):
for j in range(0, col):
Ox[i][j] = math.cos(2*angle[i][j])
Oy[i][j] = math.sin(2*angle[i][j])
Ox = low_pass_filter(Ox, blur_size)
Oy = low_pass_filter(Oy, blur_size)
for i in range(0, row):
for j in range(0, col):
angle[i][j] = 0.5*math.atan(Oy[i][j]/Ox[i][j])#take the final orientation of all 17*17 blocks
return angle
algorithmをに設定しています。オリエンテーションイメージセクション ですが、コードが正しく機能しないため、正しい方向のマップが得られません。これをトラブルシューティングするのに役立つものはどれですか?
B.R