Counting the pixels within a circle detected in an image
古いコメントを表示
Hi everyone.
Based on this image,
Using Hough Transformation, I managed to detect many circles. But I require only the middle circle detected around the pupil. There are several methods that I was thinking, that could remove the other circles.
For example,
1) counting the number of black pixels within the circle and the one with the most is the pupil. 2) taking the white pixels along the circumference of the pupil. the one with the most white pixels is the pupil.
I was thinking number 2 would be a more accurate solution. Hence, how do I count the number of white pixels?
Thank you!
採用された回答
その他の回答 (1 件)
Image Analyst
2011 年 12 月 23 日
0 投票
I think you should look at what you said: "require only the middle circle." Now since you placed those circles, you know where the centers are. So you simply take the center that is closest to (numberOfRows/2, numberOfColumns/2). It's as simple as that, assuming the circle you want is the one closest to the middle of the image.
6 件のコメント
Ivan
2011 年 12 月 27 日
Image Analyst
2011 年 12 月 27 日
Well why are you getting so many false positives in the first place? Maybe you can adjust the Hough parameters to get fewer. The ones it's getting don't all look right. Maybe you should just threshold on intensity and look for circular regions? Once you have your regions, do some size filtering (see my BlobsDemo File Exchange for a tutorial), and some circularity filtering and then measure the intensity of what's left.
measurements = regionprops(labeledImage, grayImage, 'MeanIntensity');
(You need > R2008a - if you don't see BlobsDemo for code to work with earlier/all versions)
The darkest one will be the pupil.
Ivan
2011 年 12 月 28 日
Ivan
2012 年 1 月 4 日
Image Analyst
2012 年 1 月 12 日
I didn't give a demo. Upload your image to tinypic.com and your code for finding the circle locations.
Ivan
2012 年 1 月 17 日
カテゴリ
ヘルプ センター および File Exchange で Image Transforms についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!