How to robustly find the pupil on an image automatically?

조회 수: 10 (최근 30일)
Yuhan Yang
Yuhan Yang 2020년 10월 30일
댓글: Stephan 2020년 10월 31일
I have images like this:
They are from mouse eye reocording. I want to develop a code that can automatically draw the pupil on each image. At frist, I binarize the images like this and use the binarized image to find the pupil:
binaryImage = ~imbinarize(img,0.05);
binaryImage=imfill(binaryImage,'holes');
binaryImage=bwmorph(binaryImage,'open');
However, the method is not robust to corneal reflection (the super bright spot on the image), whisker arosal (the bright line). And when the pupil is large as the image shown above, it can't detect the pupil accurately around the edge. Here's the binarized result of the above image
I think the binarization method is not superior as it doesn't consider a condition that the pupil is round. Is there a better algorithm to solve it?

채택된 답변

Stephan
Stephan 2020년 10월 30일
Using the imfindcircles function and giving some additional informations by using the options could help - play with sensitivity option and maybe other options. The following code worked for your example picture:
I = imread('image.png');
[c, r] = imfindcircles(I,[20 40],'ObjectPolarity','dark','Sensitivity',0.9)
imshow(I)
viscircles(c, r,'EdgeColor','b');
  댓글 수: 2
Yuhan Yang
Yuhan Yang 2020년 10월 30일
That works! Thanks for your help. By the way, what's the definition of the "metric" in the imfindcircles function? Can I use it as a measure of the accuracy of the segmentation?
Stephan
Stephan 2020년 10월 31일
Not sure about that. Maybe Image Analyst knows.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

제품


릴리스

R2018a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by