Error in k means clustering code. 'Error using reshape Number of elements must not change. Use [] as one of the size inputs to automatically calculate the appropriate size for that dimension.' The code is here.

1 回表示 (過去 30 日間)
grayImage= imread('CYST RENAL-33.jpg');
g = rgb2gray(grayImage);
imshow(grayImage);
b=grayImage(:);
[m n]=kmeans(b,3);
m=reshape(m,size(grayImage,1),size(grayImage,2));
B=labeloverlay(grayImage,m);
figure;
imshow(B);
Pls help me to solve this error. Any help is appreciated

採用された回答

KSSV
KSSV 2021 年 5 月 12 日
This line:
b=grayImage(:);
Should be replaced with:
b = g(:) ;

その他の回答 (0 件)

製品


リリース

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by