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