指静脉代码学习---11.静脉毛刺的去除

一、论文相关

二、代码实现:

1.代码一

#四周全黑
def black(img):
    rows,cols=img.shape
    for i in range(rows):
        img[i][0]=0
        img[i][cols-1]=0
    for j in range(cols):
        img[0][j]=0
        img[rows-1][j]=0
    return img

def findBurr(img,i,j,q):
    if q.full():
        while(not q.empty()):
            index=q.get()
            img[index[0]][index[1]]=1
        # print(q.empty())
        return img
    else:
        n = neighbours(i, j, img)
        if sum(n) > 1:
            return img
        else:
            if sum(n) == 0:
                img[i][j] = 0
                return img
            else:
                q.put([i, j])
                img[i][j] = 0
                for x in range(i - 1, i + 2):
                    for y in range(j - 1, j + 2):
                        if img[x][y] == 1:
                            i = x
                 

你可能感兴趣的:(指静脉识别,学习,python,开发语言)