I've been reading about the subject but cannot get the idea in "plain English" about the usage and parameters for HoughCircles
(specially the ones after CV_HOUGH_GRADIENT
).
What's an accumulator threshold? Are 100 "votes" a right value?
I could find and "mask" the pupil, and worked my way through the Canny
function, but I'm struggling beyond that and my problem is the HoughCircles
function. There seems to be failing at finding the Iris' circle and I don't know why.
And this is the function I'm working on:
def getRadius(area):
r = 1.0
r = math.sqrt(area/3.14)
return (r)
def getIris(frame):
grayImg = cv.CreateImage(cv.GetSize(frame), 8, 1)
cv.CvtColor(frame,grayImg,cv.CV_BGR2GRAY)
cv.Smooth(grayImg,grayImg,cv.CV_GAUSSIAN,9,9)
cv.Canny(grayImg, grayImg, 32, 2)
storage = cv.CreateMat(grayImg.width, 1, cv.CV_32FC3)
minRad = int(getRadius(pupilArea))
circles = cv.HoughCircles(grayImg, storage, cv.CV_HOUGH_GRADIENT, 2, 10,32,200,minRad, minRad*2)
cv.ShowImage("output", grayImg)
while circles:
cv.DrawContours(frame, circles, (0,0,0), (0,0,0), 2)
# this message is never shown, therefore I'm not detecting circles
print "circle!"
circles = circles.h_next()
return (frame)