【问题标题】:How to detect circles in a region of interest using HoughCircles in openCV?如何使用openCV中的HoughCircles检测感兴趣区域中的圆圈?
【发布时间】:2013-07-06 13:31:50
【问题描述】:

我正在尝试使用圆形检测来检测瞳孔。当我将整个 Mat 图像 (mGray) 输入 HoughCircles 函数时,它会检测到许多圆圈,但是当我将 Mat 图像缩小到面部 ROI 或眼睛区域 ROI 时,它不会检测到任何圆圈。

这是我的代码:

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

我的参数设置是否正确?有什么我没有正确理解的地方吗?

谢谢!

【问题讨论】:

    标签: android opencv face-detection


    【解决方案1】:

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

    【讨论】:

      猜你喜欢
      • 2012-04-25
      • 2013-03-03
      • 2014-12-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-01-06
      相关资源
      最近更新 更多