1

我在java中使用opencv来检测眼图中的圆(虹膜和瞳孔)。但我没有得到应有的结果。关于在java中使用hough圈检测虹膜和瞳孔圈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)   `enter code here`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

我不知道是什么,如果问题是出在霍夫圈子功能或其他东西的参数

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

+0

请分享中间结果(坎尼)和原始图像。 – FiReTiTi

+0

@FiReTiTi,我编辑了上面的问题,并添加了原始图像和canny结果,实际上我删除了hough circle的结果,因为我在这里有限制。添加链接或照片(不超过两个链接) – Reema

+0

我有同样的问题与ough圈定位瞳孔,结果证明,ough circle不适合这种情况,因为瞳孔不是精确的圆圈。 –

回答

0

霍夫变换无法检测到你想要的圆圈在这个可靠的结果!边缘太多。您必须先清洁图像。

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

此外,我也想尝试执行皮肤检测(简单的阈值到HSV色彩空间,这将消除90%的研究领域。