2013-07-09 79 views
3

我正在尝试使用圆检测来检测瞳孔。当我将整个垫子图像(mGray)喂入HoughCircles功能时,它会检测到很多圆圈,但是当我将垫子图像缩小到面部ROI或眼睛区域ROI时,它不会检测到任何圆圈。如何使用openCV中的HoughCircles检测感兴趣区域中的圆圈?

这里是我的代码:

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);  
    } 

是否设置正确参数我?有没有我不正确的理解?

谢谢!

回答

0

如果应用移位不起作用,尝试降低Hough检测器中的阈值时,我怀疑您没有在mRgba映像中绘制圆时移动检测到的中心(它们在ROI坐标中检测到)。