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

1 Ansicht (letzte 30 Tage)
Jude Cyrus Simon Anandraj
Jude Cyrus Simon Anandraj am 28 Mär. 2013
error that i got is Error in ==> Untitled3 at 16 [cluster_idx cluster_center] = kmeans(ab,nColors,'distance','sqEuclidean','Replicates',3);
  2 Kommentare
Chandra Shekhar
Chandra Shekhar am 28 Mär. 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 am 28 Mär. 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');

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Chandra Shekhar
Chandra Shekhar am 28 Mär. 2013
  1 Kommentar
debasmita bhoumik
debasmita bhoumik am 2 Feb. 2016
this link is not opening. i am facing same problem. what should i do

Melden Sie sich an, um zu kommentieren.

Community Treasure Hunt

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

Start Hunting!

Translated by