Counting the pixels within a circle detected in an image
Mostrar comentarios más antiguos
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!
Respuesta aceptada
Más respuestas (1)
Image Analyst
el 23 de Dic. de 2011
0 votos
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 comentarios
Ivan
el 27 de Dic. de 2011
Image Analyst
el 27 de Dic. de 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
el 28 de Dic. de 2011
Ivan
el 4 de En. de 2012
Image Analyst
el 12 de En. de 2012
I didn't give a demo. Upload your image to tinypic.com and your code for finding the circle locations.
Ivan
el 17 de En. de 2012
Categorías
Más información sobre Image Arithmetic en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!