image segmentation by k mean
이전 댓글 표시
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
답변 (1개)
Walter Roberson
2013년 6월 14일
편집: Walter Roberson
2013년 6월 14일
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
mangood UK
2013년 6월 14일
편집: mangood UK
2013년 6월 14일
Image Analyst
2013년 6월 14일
편집: Image Analyst
2013년 6월 14일
It means that by using thresholding you can make sure the circle and the rectangular objects are both classified as "foreground" - they're both in the "foreground" cluster instead of the medium gray things being classified incorrectly as part of the "background" cluster. I don't see any need to use kmeans at all in this situation. Segmentation via thresholding is all you need and is the simplest approach.
mangood UK
2013년 6월 14일
Image Analyst
2013년 6월 14일
편집: Image Analyst
2013년 6월 14일
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
카테고리
도움말 센터 및 File Exchange에서 Image Segmentation에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!