kmeans Segmentation Clarification for color images

I had segmented the attached image using kmeans. After kmeans color image segmentation, when I had plotted the cluster centers, I found that, the cluster center was not at the correct point. Why?

댓글 수: 4

Please show your code.
dataImage = imread('fpot3_1.jpg');
cform = makecform('srgb2lab');
lab_he = applycform(dataImage,cform);
ab = double(lab_he(:,:,2:3));
nrows = size(ab,1);
ncols = size(ab,2);
ab = reshape(ab,nrows*ncols,2);
nColors = 3;
[cluster_idx,cluster_center] = kmeans(ab,nColors,'emptyaction','singleton');
pixel_labels = reshape(cluster_idx,nrows,ncols);
imshow(pixel_labels,[]); hold on;
plot(cluster_center(:,2),cluster_center(:,1),'r*')
can you please explain each line of k means segmentation?
You can try mine (attached). I always put in lots of comments.

댓글을 달려면 로그인하십시오.

 채택된 답변

Anand
Anand 2014년 2월 16일

0 개 추천

Your cluster centers are not in the XY co-ordinate space. They are in the AB color space. So cluster_center does not refer to a location on the image.

추가 답변 (1개)

Image Analyst
Image Analyst 2014년 2월 16일

0 개 추천

댓글 수: 3

I closely following up your file exchange list. I had worked with all your demos in that list. But right now I'm working with kmeans Color Image Segmentation.
Anand
Anand 2014년 2월 17일
What didn't work in the link Image Analyst suggested?

댓글을 달려면 로그인하십시오.

태그

질문:

2014년 2월 11일

댓글:

2018년 10월 3일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by