Counting the pixels within a circle detected in an image
Mostra commenti meno recenti
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!
Risposta accettata
Più risposte (1)
Image Analyst
il 23 Dic 2011
0 voti
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 Commenti
Ivan
il 27 Dic 2011
Image Analyst
il 27 Dic 2011
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
il 28 Dic 2011
Ivan
il 4 Gen 2012
Image Analyst
il 12 Gen 2012
I didn't give a demo. Upload your image to tinypic.com and your code for finding the circle locations.
Ivan
il 17 Gen 2012
Categorie
Scopri di più su Image Arithmetic in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!