필터 지우기
필터 지우기

Matrix Dimension Must Agree

조회 수: 2 (최근 30일)
bayoishola20
bayoishola20 2014년 9월 1일
댓글: bayoishola20 2014년 9월 20일
I've trained six(6) classes of features & performed image segmentation but trying to ascertain the accuracy of this, but it keeps telling me 'matrix dimension must agree' among the run error. Below is my segmentation code as well as roi.
"1.jpg" is not a gray image.
he= imread('C:\Users\ISHOLA\Desktop\1.jpg');
imshow(he)
cform = makecform('srgb2lab');
lab_he = applycform(he,cform);
ab = double(lab_he(:,:,2:3));
nrows = size(ab,1);
ncols = size(ab,2);
disp(nrows);
disp(ncols);
ab = reshape(ab,nrows*ncols,2);
nColors = 6;
% repeat the clustering 3 times to avoid local minima
[cluster_idx cluster_center] = kmeans(ab,nColors,'distance','sqEuclidean','replicates',6);
pixel_labels = reshape(cluster_idx,nrows,ncols);
%figure,
imshow(pixel_labels,[]), title('image labeled by cluster index');
segmented_images = cell(1,3);
rgb_label = repmat(pixel_labels,[1 3]);
for
k = 1:nColors
color = he;
color(rgb_label ~= k) = 0;
segmented_images{k} = color;
end
ROI(Region of Interest);
BW_1=roipoly(he); %for class 1
But on running this for the confusion matrix,it doesn't work
[c,cm,ind,per] = confusion(BW_1,segmented_images{1});
  댓글 수: 4
Image Analyst
Image Analyst 2014년 9월 20일
You forgot to post the error message - you just snipped out a small part of all the red text and told us just the small part. I don't even know what line it errored on. But anyway, I don't have the stats toolbox so I can't run it anyway but someone else might.
bayoishola20
bayoishola20 2014년 9월 20일
okay!thanks on that!

댓글을 달려면 로그인하십시오.

답변 (0개)

Community Treasure Hunt

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

Start Hunting!

Translated by