-
用两张指纹图片中的其中一张对其验证
-
完整代码
import cv2 def cv_show(name, img): cv2.imshow(name, img) cv2.waitKey(0) def verification(src, model): sift = cv2.SIFT_create() kp1, des1 = sift.detectAndCompute(src, None) kp2, des2 = sift.detectAndCompute(model, None) flann = cv2.FlannBasedMatcher() matches = flann.knnMatch(des1, des2, k=2) ok = [] for m, n in matches: if m.distance < 0.8 * n.distance: ok.append(m) num = len(ok) if num >= 500: result = "认证通过" else: result = "认证失败" return result if __name__ == '__main__': src1 = cv2.imread("src1.bmp") cv_show('src1', src1) src2 = cv2.imread('src2.bmp') cv_show('src2', src2) model = cv2.imread('model.bmp') cv_show('model', model) result1 = verification(src1, model) result2 = verification(src2, model) print("src1验证结果为:", result1) print("src2验证结果为:", result2)
-
运行结果
本站资源均来自互联网,仅供研究学习,禁止违法使用和商用,产生法律纠纷本站概不负责!如果侵犯了您的权益请与我们联系!
转载请注明出处: 免费源码网-免费的源码资源网站 » 《OpenCV》—— 指纹验证
发表评论 取消回复