一段matlab程序,Error using ==> conv2 A and B must be full double
来源:学生作业帮 编辑:百度作业网作业帮 分类:综合作业 时间:2024/08/19 11:48:33
一段matlab程序,Error using ==> conv2 A and B must be full double matrices.
中间部分是Gabor小波变换,不用管.主要是这个double的问题,要怎么改才行?
I=imread('J:\lz\after_hist_0000.bmp');
sigma=2*pi*pi;
if isa(I,'double')~=1
I=double(I);
end
figure(6);
j=1;
for v=0:2
for u=0:5
k=pi*exp(-(v+2)/2*log(2));
q=u*pi/8;
for x=-16:16 %改变x,y的窗口大小,进行效果的比对.
for y=-16:16
tmp1=exp(-(k.*k*(x^2+y^2))/(2*sigma));
tmp2=cos(k*x*cos(q)+k*y*sin(q))-exp(-sigma/2);
tmp3=sin(k*x*cos(q)+k*y*sin(q))-exp(-sigma/2);
realpart(17+x,17+y)=tmp1*tmp2*k^2/sigma;
imagpart(17+x,17+y)=tmp1*tmp3*k^2/sigma;
end
end
imaggabout1=conv2(I,double(imagpart),'full'); realgabout1=conv2(I,double(realpart),'full');
gaborout1=sqrt(imaggabout1.*imaggabout1+realgabout1.*realgabout1);
gaborout1=255-uint8(gaborout1)
subplot(3,6,j),imshow(gaborout1);
j=j+1;
save gaborout.mat gaborout1 ;
end
end
中间部分是Gabor小波变换,不用管.主要是这个double的问题,要怎么改才行?
I=imread('J:\lz\after_hist_0000.bmp');
sigma=2*pi*pi;
if isa(I,'double')~=1
I=double(I);
end
figure(6);
j=1;
for v=0:2
for u=0:5
k=pi*exp(-(v+2)/2*log(2));
q=u*pi/8;
for x=-16:16 %改变x,y的窗口大小,进行效果的比对.
for y=-16:16
tmp1=exp(-(k.*k*(x^2+y^2))/(2*sigma));
tmp2=cos(k*x*cos(q)+k*y*sin(q))-exp(-sigma/2);
tmp3=sin(k*x*cos(q)+k*y*sin(q))-exp(-sigma/2);
realpart(17+x,17+y)=tmp1*tmp2*k^2/sigma;
imagpart(17+x,17+y)=tmp1*tmp3*k^2/sigma;
end
end
imaggabout1=conv2(I,double(imagpart),'full'); realgabout1=conv2(I,double(realpart),'full');
gaborout1=sqrt(imaggabout1.*imaggabout1+realgabout1.*realgabout1);
gaborout1=255-uint8(gaborout1)
subplot(3,6,j),imshow(gaborout1);
j=j+1;
save gaborout.mat gaborout1 ;
end
end
![一段matlab程序,Error using ==> conv2 A and B must be full double](/uploads/image/z/496522-10-2.jpg?t=%E4%B8%80%E6%AE%B5matlab%E7%A8%8B%E5%BA%8F%2CError+using+%3D%3D%3E+conv2+A+and+B+must+be+full+double)
conv2,是对矩阵求协方差,所以realpart和imagpart必须是矩阵,但你这里没有定义.
可以在for循环前面添加这两个矩阵的定义.
realpart(17+16,17+16) = 0.0;
imagpart(17+16,17+16) = 0.0;
for v=0:2
for u=0:5
k=pi*exp(-(v+2)/2*log(2));
q=u*pi/8;
for x=-16:16 %改变x,y的窗口大小,进行效果的比对.
for y=-16:16
tmp1=exp(-(k.*k*(x^2+y^2))/(2*sigma));
tmp2=cos(k*x*cos(q)+k*y*sin(q))-exp(-sigma/2);
tmp3=sin(k*x*cos(q)+k*y*sin(q))-exp(-sigma/2);
realpart(17+x,17+y)=tmp1*tmp2*k^2/sigma;
imagpart(17+x,17+y)=tmp1*tmp3*k^2/sigma;
end
end
可以在for循环前面添加这两个矩阵的定义.
realpart(17+16,17+16) = 0.0;
imagpart(17+16,17+16) = 0.0;
for v=0:2
for u=0:5
k=pi*exp(-(v+2)/2*log(2));
q=u*pi/8;
for x=-16:16 %改变x,y的窗口大小,进行效果的比对.
for y=-16:16
tmp1=exp(-(k.*k*(x^2+y^2))/(2*sigma));
tmp2=cos(k*x*cos(q)+k*y*sin(q))-exp(-sigma/2);
tmp3=sin(k*x*cos(q)+k*y*sin(q))-exp(-sigma/2);
realpart(17+x,17+y)=tmp1*tmp2*k^2/sigma;
imagpart(17+x,17+y)=tmp1*tmp3*k^2/sigma;
end
end
一段matlab程序,Error using ==> conv2 A and B must be full double
这个matlab程序显示错误?Error using ==> conv A and B must be vectors.
matlab如何解决?Error using ==> conv A and B must be vectors.
matlab Error using ==> mpower Inputs must be a scalar and a
matlab错误 Error using ==> mpower Inputs must be a scalar and
matlab报错?Error using ==> mpower Inputs must be a scalar and
MATLAB程序,这个程序不知道为什么出现?Error using ==> mpower Matrix must be
matlab程序运行总是出现? Error using ==> sym.mpower Matrix must be sq
MATLAB程序总是出现?Error using ==> stem at 44 X must be same lengt
matlab程序问题,Error using ==> mrdivide Matrix dimensions must a
matlab Error using ==> mpower Matrix must be square.
matlab计算时出现“ Error using ==> mpower Inputs must be a scalar