Reputation: 35
I am trying to detect the pupil using circle detection. When I feed the entire Mat image (mGray) into the HoughCircles function, it detects many circles, but when I reduce the Mat image to the face ROI or eye area ROI, it doesn't detect any circles.
Here is my code:
faceROI = mGray.submat(facesArray[i]);
Imgproc.GaussianBlur(faceROI,faceROI, new Size(9,9),2,2);
Mat circles = new Mat();
Imgproc.HoughCircles(faceROI,circles,Imgproc.CV_HOUGH_GRADIENT,2,150,200,100,0,0);
for (int x = 0; x<circles.cols(); x++) {
double Circle[] = circles.get(0, x);
Point center = new Point(Math.round(Circle[0]), Math.round(Circle[1]));
int radius = (int)Math.round(Circle[2]);
Core.circle(mRgba, center,2, new Scalar(0,0,255),4);
Core.circle(mRgba,center,radius,new Scalar(0,0,0),4);
}
Are my parameters set correctly? Is there something I'm not understanding correctly?
Thank you!
Upvotes: 3
Views: 1610
Reputation: 10850
I suspect you are not shift detected centers (they are detected in ROI coordinates) when drawing circles in mRgba image if applying shift will not help, try reduce thresholds in Hough detector.
Upvotes: 0