【问题标题】:Iris and pupil detection in image with Java and OpenCV使用 Java 和 OpenCV 检测图像中的虹膜和瞳孔
【发布时间】:2015-01-08 03:25:15
【问题描述】:

我在图像中遇到了虹膜和瞳孔检测的已知问题。我已经阅读了一些主题(例如:

What are the correct usage/parameter values for HoughCircles in OpenCV for Iris detection? pupil Detection and cvHoughCircles? Using HoughCircles to detect and measure pupil and iris HoughCircles Parameters to recognise balls

关于这个问题,但仍然找不到我的问题的解决方案。

我有一张眼睛图像,我想做的是检测虹膜和瞳孔。我的问题是,我无法选择好的参数值。

这是我的输入示例图片: 这是我的输出:

我的代码发布在下面。

 Mat src = Highgui.imread("in.jpg", Highgui.CV_LOAD_IMAGE_GRAYSCALE);       
 Mat des = new Mat(src.rows(), src.cols(), src.type());
 Imgproc.GaussianBlur(src,src, new Size(3,3),0,0); 
 Imgproc.Canny(src, dst,  5, 10);
 Mat circles = new Mat();
 Imgproc.HoughCircles(source, circles, Imgproc.CV_HOUGH_GRADIENT, 1.0, 20.0, 70.0, 30.0, 3, 100);
 //draw circles code here

我想要一个带圆圈的瞳孔和虹膜。有人可以为我的圆圈检测发布正确的值吗?
我也有几个问题:

1) 使用 Canny 或 Sobel 过滤器更好吗?

2) 我可以更好、更灵活地进行这种检测吗?

3) 你能简单解释一下 HoughCircles 参数的确切含义吗? (来自 OpenCV javadoc)

* @param dp Inverse ratio of the accumulator resolution to the image
  * resolution. For example, if <code>dp=1</code>, the accumulator has the same
  * resolution as the input image. If <code>dp=2</code>, the accumulator has half
  * as big width and height.
* @param param1 First method-specific parameter. In case of <code>CV_HOUGH_GRADIENT</code>,
  * it is the higher threshold of the two passed to the "Canny" edge detector
  * (the lower one is twice smaller).
* @param param2 Second method-specific parameter. In case of <code>CV_HOUGH_GRADIENT</code>,
  * it is the accumulator threshold for the circle centers at the detection
  * stage. The smaller it is, the more false circles may be detected. Circles,

【问题讨论】:

  • 您的精明阈值太低了。尝试显示你的中间图像,你会看到一些非常“嘈杂”的东西;)
  • 您的概念问题可能是,虹膜边界和瞳孔边界的边缘强度差异很大,因此您很容易检测到瞳孔,但虹膜可能更难。
  • @Micka 基于我在 stacoverflow 找到的一些主题,我添加了阈值的自动计算,例如: maxThreshold = Imgproc.threshold(source, tmp, 0, 255, Imgproc. THRESH_BINARY | Imgproc.THRESH_OTSU); minThreshold 对我来说是 5.0*maxThres。它可以正确检测瞳孔,但我仍然需要转很多圈。更重要的是,它没有检测到虹膜。我还能改变什么?
  • 如果您也有彩色图像,请尝试检测 HSV H 通道中的圆圈。不知道还能做什么,自己也没找到简单的虹膜阈值...
  • 我会尝试找到这个应用程序的源代码,但老实说我很担心找不到。

标签: java opencv hough-transform


【解决方案1】:

霍夫圆并不是一种很好的虹膜/瞳孔检测方法。它不是很可靠,而且您最终会调整过多的参数。

经过一些基本的阈值处理或精巧的边缘检测后,像 MSER 这样的特征检测方法在这些情况下效果更好。 Here 是类似的问题,有解决方案。

因为你有一个很好的分辨率图像,如果你想测量它们或想要一些非常准确的东西,我建议this 博客。它对所涉及的步骤进行了详细说明。

【讨论】:

    猜你喜欢
    • 2013-07-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-11-19
    • 2017-05-19
    • 2018-10-04
    • 1970-01-01
    相关资源
    最近更新 更多