i got error in color based segmentation using K-means?

조회 수: 2 (최근 30일)
Jude Cyrus Simon Anandraj
Jude Cyrus Simon Anandraj 2013년 3월 28일
댓글: debasmita bhoumik 2016년 2월 2일
error that i got is Error in ==> Untitled3 at 16 [cluster_idx cluster_center] = kmeans(ab,nColors,'distance','sqEuclidean','Replicates',3);
  댓글 수: 2
Chandra Shekhar
Chandra Shekhar 2013년 3월 28일
post your full code or give link of your program which you used. I need to know how your passing inputs to the function.
Jude Cyrus Simon Anandraj
Jude Cyrus Simon Anandraj 2013년 3월 28일
clc clear all; he = imread('sam.tif'); imshow(he),
cform = makecform('srgb2lab'); lab_he = applycform(he,cform);
ab = double(lab_he(:,:,3)); nrows = size(ab,1); ncols = size(ab,2); ab = reshape(ab,nrows*ncols,1);
nColors = 3;
[cluster_idx cluster_center] = kmeans(ab,nColors,'distance','sqEuclidean', ... 'Replicates',3);
pixel_labels = reshape(cluster_idx,nrows,ncols); imshow(pixel_labels,[]), title('image labeled by cluster index');
segmented_images = cell(1,3); rgb_label = repmat(pixel_labels,[1 1 3]);
for k = 1:nColors color = he; color(rgb_label ~= k) = 0; segmented_images{k} = color; end
figure;imshow(segmented_images{1}), title('objects in cluster 1');
figure;imshow(segmented_images{2}), title('objects in cluster 2');
figure;imshow(segmented_images{3}), title('objects in cluster 3');

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

답변 (1개)

Chandra Shekhar
Chandra Shekhar 2013년 3월 28일
  댓글 수: 1
debasmita bhoumik
debasmita bhoumik 2016년 2월 2일
this link is not opening. i am facing same problem. what should i do

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

Community Treasure Hunt

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

Start Hunting!

Translated by