MATLAB: Matrix dimensions must agree.error in t=r.*e;

binarisation of image

%Binarisation
e=im2bw(z);
figure,imshow(e);
title('binarized image');
r=im2bw(w);
t=r.*e;
figure,imshow(t);
k=bwmorph(~t,'thin','int');
figure,imshow(k);
title('morphological processed image');

Best Answer

We have no reason to expect, given the code you show, that z and w were originally the same size. If they are not, then it will not be possible to multiply their binary equivalents.