My project is to extract the invariant features of iris of a missing person and compare it with the found people to find the match.
I successfully applied haar-cascade to detect face and eyes then applied smooth() and canny() for removing noise and edge detection
Now am stuck with hough circle to detect the pupil and center of pupil , ie iris position.. I've to adjust the parameters of hough circle for each image so that it detect the pupil..And i've no idea how'll i get the center and proceed to extract the invariant feature of iris.. please help!
here is my code
import numpy as np
import cv2
face_cascade =cv2.CascadeClassifier('haarcascade_frontalface_default.xml')
eye_cascade = cv2.CascadeClassifier('haarcascade_eye_tree_eyeglasses.xml')
img = cv2.imread('sheikha.jpg',0)
img = cv2.bilateralFilter(img, 5, 175, 175)
edges = cv2.Canny(img, 100, 100)
faces = face_cascade.detectMultiScale(
img, scaleFactor=1.3, minNeighbors=5, minSize=(30, 30))
print "Detected %d faces." % len(faces)
print "Drawing rectangles..."
for (x, y, w, h) in faces:
cv2.rectangle(img, (x, y), (x + w, y + h), (0,255,0), 2)
eyes = eye_cascade.detectMultiScale(img, scaleFactor=1.3, minNeighbors=5,minSize=(10,10))
for (ex,ey,ew,eh) in eyes :
#if neye < 3:
imgCrop = edges[ey:ey+eh,ex:ex+ew]
circles = cv2.HoughCircles(imgCrop,cv2.cv.CV_HOUGH_GRADIENT,1,60,param1=90,param2=10,minRadius=10,maxRadius=20)
circles = np.uint16(np.around(circles))
for i in circles[0,:]:
cv2.circle(imgCrop,(i[0],i[1]),i[2],(255,255,0),2)
print "Drawn Rectangles."
#cv2.imshow('edge',edges)
cv2.imshow('image',imgCrop)
cv2.waitKey(0)
cv2.destroyAllWindows()