preprocess.py 文件源码

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

项目:Fingerprint-Recognition 作者: zhangzimou 项目源码 文件源码
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
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号