image segmentation by k mean
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
dear member
i have these image that captured by a webcam
i try to segment the image to get any object using k mean with k=2 with ground all ways black
the problem is when i execute the k mean on image on real time with square or circle object the result binary image is perfect
but when both objects(square and circle) appear in same image the square object is disappear or the k mean consider it as background not as foreground object
as ground is black all the time and the light only change on my room what is the best pre processioning that must done before the k mean applied so any object will appear in binary image
best regards
Réponses (1)
Walter Roberson
le 14 Juin 2013
Modifié(e) : Walter Roberson
le 14 Juin 2013
Suppose the circle is intensity 255, and suppose the background is intensity 0. If the rectangle is intensity 128 to 255, it will be closer to the circle's intensity and classified with it, but if the rectangle is intensity 1 to 127 then it would be closer to the background's intensity and so clustered with it. My estimate by eye is that the rectangle is less than half bright.
The problem would not occur when the circle is not there, because then the only two values would be 0 and the rectangle's intensity and those are fairly distinct.
What you should do is threshold against a low level such as (say) 16 and say that anything below that level is background.
BW = IM > Threshold;
and then analyze BW. Or alternately,
BW = IM > Threshold;
PartialIM = IM(BW);
kmeans(PartialIM(:), 2)
4 commentaires
Image Analyst
le 14 Juin 2013
Modifié(e) : Image Analyst
le 14 Juin 2013
That binary image doesn't look correct. What threshold value did you use? Try my interactive thresholding app: http://www.mathworks.com/matlabcentral/fileexchange/?term=authorid%3A31862
Voir également
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!