实施局部山脊定位

2024-10-01 00:29:45 发布

您现在位置:Python中文网/ 问答频道 /正文

我一直在尝试在python中实现指纹的局部脊方向。我用梯度法,用sobel算子得到我需要的梯度。但结果发现,这种方法有很多缺陷,特别是90度左右。我可以包括我目前为止已经完成的代码,但是由于它不能按我的要求工作,我不知道是否需要它。我也研究过线段法,但是,我正在研究潜在指纹,所以很难知道是应该在线段中寻找最大的黑色还是白色。我也尝试过实现一个算法来检测连续线的最大集中区域,但是我不能让它工作。对其他算法有什么建议吗?在

编辑:

我正在使用一个函数将我的函数应用于块,但这几乎不相关

def lro(im_np):

    orientsmoothsigma = 3

    Gxx = cv2.Sobel(im_np,-1,2,0)
    Gxy = cv2.Sobel(im_np,-1,1,1)
    Gyy = cv2.Sobel(im_np,-1,0,2)


    Gxx = scipy.ndimage.filters.gaussian_filter(Gxx, orientsmoothsigma)
    Gxy = numpy.multiply(scipy.ndimage.filters.gaussian_filter(Gxy, orientsmoothsigma), 2.0)
    Gyy = scipy.ndimage.filters.gaussian_filter(Gyy, orientsmoothsigma)

    denom = numpy.sqrt(numpy.add(numpy.power(Gxy,2), (numpy.power(numpy.subtract(Gxx,Gyy),2))))# + eps;
    sin2theta = numpy.divide(Gxy,denom)            # Sine and cosine of doubled angles
    cos2theta = numpy.divide(numpy.subtract(Gxx,Gyy),denom)

    sze = math.floor(6*orientsmoothsigma);
    if not sze%2: sze = sze+1       
    cos2theta = scipy.ndimage.filters.gaussian_filter(cos2theta, orientsmoothsigma)  # Smoothed sine and cosine of
    sin2theta = scipy.ndimage.filters.gaussian_filter(sin2theta, orientsmoothsigma)#filter2(f, sin2theta); # doubled angles



    orientim = math.pi/2. + numpy.divide(numpy.arctan2(sin2theta,cos2theta),2.)

    return orientim

Tags: numpynpscipygaussianfiltercv2filtersim
2条回答

你可能想看看雷蒙德泰国(指纹图像)的工作 增强和细节提取),如果你还没有。在

我很久以前就研究过这个,并写了一篇论文。正如我所记得的,寻找黑白相间的脊线(反转图像并重复分析)以得到更多的结果。我确实记得在某些角度上有些敏感。你可能需要一些比纯粹的索贝尔更广泛的东西。尽可能多的使用像素。在

相关问题 更多 >