preprocessing.py 文件源码

python
阅读 25 收藏 0 点赞 0 评论 0

项目:Fingerprint-Recognition 作者: zhangzimou 项目源码 文件源码
def ridgeComp(img,theta, blockSize,w=3,h=9,alpha=100,beta=1):
    resize=5
    N,M=np.shape(img)
    imgout=np.zeros_like(img)
    imgresizeize=cv2.resizeize(img,None,fx=resize,fy=resize,interpolation = cv2.INTER_CUBIC)
    mask=np.ones((w,h))*beta
    mask[(w-1)/2]=np.ones((1,h))*alpha
    ww=np.arange(-(w-1)/2,(w-1)/2+1)
    hh=np.arange(-(h-1)/2,(h-1)/2+1)
    hh,ww=np.meshgrid(hh,ww)
    for i in xrange((h-1)/2,N-(h-1)/2):
        block_i=i/blockSize
        for j in xrange((h-1)/2,M-(h-1)/2):
            block_j=j/blockSize
            thetaHere=theta[block_i,block_j]
            ii=np.round((i+ww*np.cos(thetaHere)-hh*np.sin(thetaHere))*resize).astype(np.int32)
            jj=np.round((j+ww*np.sin(thetaHere)+hh*np.cos(thetaHere))*resize).astype(np.int32)
            imgout[i,j]=np.sum(imgresizeize[ii,jj]*mask)/(((w-1)*beta+alpha)*h)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号