MATLAB提示Error using reshape To RESHAPE the number of elements must not change.求大神看错在哪了clear I;clear G;G=imread('I:\\2.jpg');I=rgb2gray(G);I=double(I);a=ones(1,24);n=2;L=2;d=de2bi(a);[H,W]=size(I);A=[H,W];i=0;AB=reshape(A,(H*W)/n,n
来源:学生作业帮助网 编辑:作业帮 时间:2024/11/17 00:02:54
MATLAB提示Error using reshape To RESHAPE the number of elements must not change.求大神看错在哪了clear I;clear G;G=imread('I:\\2.jpg');I=rgb2gray(G);I=double(I);a=ones(1,24);n=2;L=2;d=de2bi(a);[H,W]=size(I);A=[H,W];i=0;AB=reshape(A,(H*W)/n,n
MATLAB提示Error using reshape To RESHAPE the number of elements must not change.求大神看错在哪了
clear I;
clear G;
G=imread('I:\\2.jpg');
I=rgb2gray(G);
I=double(I);
a=ones(1,24);
n=2;
L=2;
d=de2bi(a);
[H,W]=size(I);
A=[H,W];
i=0;
A
B=reshape(A,(H*W)/n,n);
for i=1:H*W/n
for j=1:n
K(j,1)=B(i,1)*j;
end
y=mod(sum(K),(2*n+1));
r=mod((d-y),2*n+1);
if d==y
B=B;
else if =y&&rn
B(i,r)=B(i,2*n-r)-1;
end
end
end
end
MATLAB提示Error using reshape To RESHAPE the number of elements must not change.求大神看错在哪了clear I;clear G;G=imread('I:\\2.jpg');I=rgb2gray(G);I=double(I);a=ones(1,24);n=2;L=2;d=de2bi(a);[H,W]=size(I);A=[H,W];i=0;AB=reshape(A,(H*W)/n,n
很明显的错误,A=[H,W];A的型号是多少?1*2
B=reshape(A,(H*W)/n,n)改后(H*W)/n*n=H*W
除非H*W=2不然必定错啊
I的型号才是H*W
B=reshape(I,(H*W)/n,n)且(H*W)/n是整数就不会出错~