in following code error is Error using + Integers can only be combined with integers of the same class, or scalar doubles. How to remove it
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
jayamala pakhare
am 29 Mai 2018
Kommentiert: jayamala pakhare
am 29 Mai 2018
rgb = imread('peppers.png'); %'D:\OLD L\HSV_segment\42049.jpg'
cform = makecform('srgb2lab');
lab = applycform(rgb,cform);
ab = lab(:,:,2:3);
nrows = size(ab,1);
ncols = size(ab,2);
ab = reshape(ab,nrows*ncols,2);
nColors = 3;
[cluster_idx, cluster_center] = kmeans(ab,nColors,'distance','sqEuclidean', 'Replicates',3);
pixel_labels = reshape(cluster_idx,nrows,ncols);
figure,imshow(pixel_labels,[]), title('image labeled by cluster index');
0 Kommentare
Akzeptierte Antwort
KSSV
am 29 Mai 2018
Try:
ab = double(reshape(ab,nrows*ncols,2));
ab is of class uint8. Convert it to double.
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Point Cloud Processing finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!