How to remove some edges after applying edge detection?

I need to find the edges of the iris, the input images that I use are not a fully rounded iris, sometimes it can be covered with an eyelid. I found a summary of the magazine article to find the iris, even covered with an eyelid. However, I was stuck on one of the steps. Again, this is because only a summary, and I can not find the full text of this article.

Here, where I am stuck, I have an image, and this is already implied by detecting vertical snapping. I have an image, here is the image:

Input image

And this image after applying vertical edge detection:

enter image description here

I need to remove all edges except the edge of the iris (red edge).

enter image description here

My expected result should look like this:

enter image description here

Note. Some images may have only the left or right edges of the pupil, as shown above, but some images may have left and right edges for the pupil.

In my opinion, there are two ways to get ribs.

  • Remove the horizontal edges, since the edges of the pupil are vertical. But I do not know how to remove horizontal edges, and its not very horizontal lines, its meandering horizontal lines.

  • Find the longest edges in the image (I also don’t know which algorithm will find the longest edges).

Which one is the right way to solve my problem? or not both options above?

If you know the search method for incompletely rounded objects, especially for the iris, please tell me, this makes my project easier.

+5
source share
2 answers

This is a feature detection problem, so I would use the Hough Circle Transformation in the OpenCV library ( tutorial ). You can see in the screenshot that the method is quite simple in detecting partial roundness.


enter image description here

import cv2 import cv2.cv as cv import numpy as np img = cv2.imread(r'C:\path\to\eye.jpg',0) img = cv2.medianBlur(img,5) cimg = cv2.cvtColor(img,cv2.COLOR_GRAY2BGR) circles = cv2.HoughCircles(img,cv.CV_HOUGH_GRADIENT,1,20, param1=150,param2=30,minRadius=20,maxRadius=100) circles = np.uint16(np.around(circles)) for i in circles[0,:]: # draw the outer circle cv2.circle(cimg,(i[0],i[1]),i[2],(0,255,0),2) # draw the center of the circle cv2.circle(cimg,(i[0],i[1]),2,(0,0,255),3) cv2.imshow('detected circles',cimg) cv2.waitKey(0) cv2.destroyAllWindows() 
+4
source

I'm trying to answer your question, I suggest you use the Hough Transform circle. I am trying to detect a circular so that you can get the radius of the circle, and then you can get the size of the circle.

Here is the code and the result:

 A = imread('eye.jpg'); A = imresize(A, 0.8); A = rgb2gray(A); A = edge(A, 'canny'); imshow(A); [centers, radii, metric] = imfindcircles(A,[1 100]); centersStrong5 = centers(1:1,:); radiiStrong5 = radii(1:1); metricStrong5 = metric(1:1); viscircles(centersStrong5, radiiStrong5,'EdgeColor','b'); 

And the result:

enter image description here

Hope this helps your issue.

Link to the code: http://www.mathworks.com/help/images/ref/imfindcircles.html

+3
source

All Articles