【问题标题】:about detecting iris and pupil circles using hough circle in java opencv关于在java opencv中使用霍夫圆检测虹膜和瞳孔圆
【发布时间】:2015-11-07 15:10:41
【问题描述】:

我在 Java 中使用 opencv 尝试检测带有眼睛的图像中的圆圈(虹膜和瞳孔),但没有得到预期的结果。

这是我的代码

// convert source image to gray
org.opencv.imgproc.Imgproc.cvtColor(mRgba, imgCny, Imgproc.COLOR_BGR2GRAY);
//fliter

org.opencv.imgproc.Imgproc.blur(imgCny, imgCny, new Size(3, 3));
//apply canny

org.opencv.imgproc.Imgproc.Canny(imgCny, imgCny, 10, 30);
//apply Hough circle

Mat circles = new Mat();
Point pt;

org.opencv.imgproc.Imgproc.HoughCircles(imgCny, circles, Imgproc.CV_HOUGH_GRADIENT, imgCny.rows() / 4, 2, 200, 100, 0, 0);
//draw the found circles
for (int i = 0; i < circles.cols(); i++) {
    double vCircle[] = circles.get(0, i);

    pt = new Point((int) Math.round((vCircle[0])), (int) Math.round((vCircle[1])));

    int radius = (int) Math.round(vCircle[2]);
    Core.circle(mRgba, pt, radius, new Scalar(0, 0, 255), 3);
}

the original image

canny result

我不知道是什么问题。问题是出在找到的圆函数的参数上还是其他什么的。

有没有人遇到过这样的问题或知道如何解决?

【问题讨论】:

  • 请分享中间结果(Canny)和原始图像。而且我认为模糊步骤是没有必要的,因为你想要有锐利的边缘。
  • @FiReTiTi ,我在上面编辑了我的问题并添加了原始图像和精明的结果。实际上我删除了霍夫圆结果,因为我在这里添加链接或照片有限制(不超过两个链接)
  • 我在用霍夫圆定位瞳孔时遇到了同样的问题,结果证明霍夫圆不适合这种情况,因为瞳孔不是精确的圆。

标签: java opencv android-studio image-segmentation iris-recognition


【解决方案1】:

霍夫变换无法在这个精巧的结果中检测到您想要的圆圈!边缘太多了。您必须先清理图像。

从黑色(瞳孔、虹膜内部)和白色检测开始。这两个区域将划定 ROI。

此外,我还会尝试执行皮肤检测(HSV 颜色空间的简单阈值。它将消除 90% 的研究区域。

【讨论】:

    猜你喜欢
    • 2012-09-16
    • 2015-01-08
    • 2016-05-19
    • 1970-01-01
    • 1970-01-01
    • 2013-07-27
    • 1970-01-01
    • 2011-02-22
    • 1970-01-01
    相关资源
    最近更新 更多