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

1 vue (au cours des 30 derniers jours)
Jude Cyrus Simon Anandraj
Jude Cyrus Simon Anandraj le 28 Mar 2013
error that i got is Error in ==> Untitled3 at 16 [cluster_idx cluster_center] = kmeans(ab,nColors,'distance','sqEuclidean','Replicates',3);
  2 commentaires
Chandra Shekhar
Chandra Shekhar le 28 Mar 2013
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 le 28 Mar 2013
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');

Connectez-vous pour commenter.

Réponses (1)

Chandra Shekhar
Chandra Shekhar le 28 Mar 2013
  1 commentaire
debasmita bhoumik
debasmita bhoumik le 2 Fév 2016
this link is not opening. i am facing same problem. what should i do

Connectez-vous pour commenter.

Community Treasure Hunt

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

Start Hunting!

Translated by