basic.py 文件源码

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

项目:Fingerprint-Recognition 作者: zhangzimou 项目源码 文件源码
def binarize2(img,theta,blockSize,h=9):
    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)
    blockMean=blockproc(img,np.mean,(blockSize,blockSize),True)
    hh=np.arange(-(h-1)/2,(h-1)/2+1)
    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-hh*np.sin(thetaHere))*resize).astype(np.int32)
            jj=np.round((j+hh*np.cos(thetaHere))*resize).astype(np.int32)
            imgout[i,j]=255 if (np.mean(imgresizeize[ii,jj])>blockMean[block_i,block_j]) else 0
    return imgout
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号