1

我正在将虹膜识别项目作为毕业项目。

计划是这样的:

1- 获取虹膜图像(找到 CASIA 数据库) 2- 检测虹膜(部分完成) 3- 切割虹膜区域(完成) 4- 插值图像(卡住) 5- 应用 gabor 过滤器(完成) 6- 应用 canny(完成)7-计算汉明距离(完成)

import numpy
import cv2
import numpy as np
import os
import math
import scipy

import os


directory = os.listdir("C:/Users/ROOT\Documents/CASIA_IrisDatabase/005/1")
numero_file = len(directory)

print (numero_file)
for file in directory:
    print(file)
#file_iride = raw_input("File(riportare anche estensione): ")

for file in directory:
    path = "C:/Users/ROOT\Documents/CASIA_IrisDatabase/005/1/%s" % (file)
    image_iride = cv2.imread(path)
    output = image_iride.copy()
    image_test = cv2.imread(path)


    image_test = cv2.Canny(image_test, 25, 50, apertureSize=5)
    cv2.imshow("Image test", image_test)
    image_test = cv2.GaussianBlur(image_test, (7, 7), 3)

    #cerchi = cv2.HoughCircles(image_test, cv2.HOUGH_GRADIENT,50, 100.0, 30, 100,100,70)
    #cerchi = cv2.HoughCircles(image_test, cv2.HOUGH_GRADIENT, 2, 400, 50, 100, 100, 100)
    cerchi = cv2.HoughCircles(image_test, cv2.HOUGH_GRADIENT, 1.3, 800)
    if cerchi is not None:
        cerchi = np.round(cerchi[0, :]).astype("int")
        for (x, y, raggio) in cerchi:
           cv2.circle(output, (x, y), 108, (255, 0, 0), 4)
           cv2.imshow("Image test", np.hstack([image_iride, output]))
           print (raggio)
        cv2.waitKey()

        x1 = x - 108
        x2 = x + 108
        y1 = y - 108
        y2 = y + 108
        #img2 = image_iride[y:y2,x1:x2]
        #cv2.imshow("Image test", img2)
        #cv2.waitKey()
        img2 = image_iride[y1:y2,x1:x2]
        cv2.imshow("Image test", img2)
        cv2.waitKey()

        img2 = cv2.linearPolar(img2, (108, 108), 108, cv2.WARP_FILL_OUTLIERS )
        cv2.imshow("Image test", img2)
        cv2.waitKey()

但是当我做线性极坐标变换时,图像就是这样,而不是一条平线。 看这里

我该怎么做左直线?

任何帮助,将不胜感激。

4

0 回答 0