过滤灰度指纹扫描图像和二进制文件

时间:2019-01-24 12:28:46

标签: python matplotlib image-processing fingerprint

我正在尝试从拇指扫描图像中获取二值化的指纹。我已经取得消除杂讯背景的功能。但我找不到能帮助我实现这一目标的过滤器。我有以下已处理的图像。

I want to extract fingerprint details in binarised form

我想以二进制形式提取指纹详细信息。我已经尝试过,

    ret1,th1 = cv2.threshold(gray,48,80,cv2.THRESH_BINARY)

# Otsu's thresholding
ret2,th2 = cv2.threshold(gray,0,255,cv2.THRESH_BINARY+cv2.THRESH_OTSU)

# Otsu's thresholding after Gaussian filtering
blur = cv2.GaussianBlur(gray,(5,5),0)
ret3,th3 = cv2.threshold(blur,0,255,cv2.THRESH_BINARY+cv2.THRESH_OTSU)

images = [gray, 0, th1,
          gray, 0, th2,
          gray, 0, th3]

titles = ['Original Noisy Image','Histogram','Global Thresholding (v=127)',
          'Original Noisy Image','Histogram',"Otsu's Thresholding",
          'Gaussian filtered Image','Histogram',"Otsu's Thresholding"]

for i in range(3):
    plt.subplot(3,3,i*3+1),plt.imshow(images[i*3],'gray')
    plt.title(titles[i*3]), plt.xticks([]), plt.yticks([])
    plt.subplot(3,3,i*3+2),plt.hist(images[i*3].ravel(),256)
    plt.title(titles[i*3+1]), plt.xticks([]), plt.yticks([])
    plt.subplot(3,3,i*3+3),plt.imshow(images[i*3+2],'gray')
    plt.title(titles[i*3+2]), plt.xticks([]), plt.yticks([])
plt.show()

这给了我

enter image description here

我还尝试了Catalano-Framework和Matlab二值化,所有这些都给了我黑白图像。 任何帮助深表感谢。

1 个答案:

答案 0 :(得分:-1)

我在MATLAB中处理了您的图像。而且我认为 Canny Edge Detector 可以很好地解决您的问题。检查结果图像。 Original Image Vs Canny Edge Detected

我希望这会对您有所帮助。 OpenCV-Python:

import cv2
import numpy as np

img = cv2.imread('thumbs_up.png',cv2.IMREAD_GRAYSCALE)
#Adjust the Range as per application
edges = cv2.Canny(img,50,200)
cv2.imshow('Output',edges)
cv2.waitKey(0)