def ridgeComp(img,theta,blockSize,boxSize,h=11):
resize=8
N,M=np.shape(img)
imgout=img.copy()
imgResize=cv2.resize(img,None,fx=resize,fy=resize,interpolation = cv2.INTER_CUBIC)
hh=np.arange(-(h-1)/2,(h-1)/2+1)
for i in xrange(10,N-10):
block_i = (i-blockSize/2)/boxSize
if block_i>=theta.shape[0]:
break
for j in xrange(10,M-10):
block_j = (j-blockSize/2)/boxSize
if block_j>=theta.shape[1]:
break
theta0=theta[block_i,block_j]
ii=np.round((i-hh*np.sin(theta0))*resize).astype(np.int32)
jj=np.round((j+hh*np.cos(theta0))*resize).astype(np.int32)
imgout[i,j]=np.mean(imgResize[ii,jj])
return imgout
评论列表
文章目录