-3

I have the problem when i use the Hough Transform. I want detect the only pupil in iris image of test. The code is the following:

import cv2
from cv2 import cv
import numpy as np
import os

directory = os.listdir("/home/joker26/Scrivania/casia/test")
numero_file = len(directory)
for file in directory:
    print file
file_iride = raw_input("File(riportare anche estensione): ")
path = "/home/joker26/Scrivania/casia/test/%s" %(file_iride)
image_iride = cv2.imread(path)
output = image_iride.copy()
image_test = cv2.imread(path, cv2.CV_LOAD_IMAGE_GRAYSCALE)

image_test = cv2.Canny(image_test,5,70,apertureSize=3)
image_test = cv2.GaussianBlur(image_test, (7,7), 1)

cerchi = cv2.HoughCircles(image_test, cv2.cv.CV_HOUGH_GRADIENT,50, 100, 50,300)
if cerchi is not None:
    cerchi = np.round(cerchi[0,:]).astype("int")
    for (x,y,raggio) in cerchi:
        cv2.circle(output, (x,y),raggio,(255,0,0),4)
    cv2.imshow("Image test", np.hstack([image_iride,output]))
    cv2.waitKey()

The result is: https://i.stack.imgur.com/LJOE9.png

crisannik
  • 1
  • 1
  • 1

2 Answers2

0

What is the point of detecting the pupil instead of the iris? They are both a part of the eye. However your error lies within your testing data.

You are using testing data that, I assume, are thousands of photos of peoples eyes. Now your computer will learn to recognize what is in these photos and if your training data is full eyes, it will display full eyes. The flaw is not in your code but in the data your code is accessing.

  • now, i have extrapolate the information about pupil, but i don't know how to extrapolate information of the iris... My idea is to paint two circles, one for the pupil and one fot the external iris... But i have some problem to make second point. I am using a database with 6 photo for the moment... – crisannik Jul 14 '16 at 08:27
0

You can use:

cerchi = cv2.HoughCircles(image_test, cv2.HOUGH_GRADIENT, 1.3, 800)