下面的matlab程序错误在哪里?怎么不运行?
来源:学生作业帮 编辑:作业帮 分类:综合作业 时间:2024/07/04 18:46:43
下面的matlab程序错误在哪里?怎么不运行?
clear
f=imread('w2.bmp');
I2=imnoise(f,'salt & pepper');
imshow(I2);title('噪声图像');
PQ=paddedsize(size(I2));
[U,V]=dftuv(PQ(1),PQ(2));
D=sqrt(U.^2+V.^2);
D0=0.05*PQ(2);
F=fft2(f,PQ(1),PQ(2));
H=exp(-(D.^2)/(2*(D0^2)));
g=dftfilt(f,H);
figure, imshow(ifftshift(H),[])
figure,imshow(log(1+abs(ifftshift(F))),[])
figure, imshow(g,[ ])
clear
f=imread('w2.bmp');
I2=imnoise(f,'salt & pepper');
imshow(I2);title('噪声图像');
PQ=paddedsize(size(I2));
[U,V]=dftuv(PQ(1),PQ(2));
D=sqrt(U.^2+V.^2);
D0=0.05*PQ(2);
F=fft2(f,PQ(1),PQ(2));
H=exp(-(D.^2)/(2*(D0^2)));
g=dftfilt(f,H);
figure, imshow(ifftshift(H),[])
figure,imshow(log(1+abs(ifftshift(F))),[])
figure, imshow(g,[ ])
试试看下面这个函数,把这个存成paddedsize.m文件,就可以调用了
function [PQ,n]=paddedsize(AB,CD,PARAM)
n=nargin;
if nargin==1
PQ=2*AB;
elseif nargin==2 & ischar(CD);
PQ=AB+CD-1;
PQ=2*ceil( PQ/2);
elseif nargin==2
m=max(AB);
P=2^nextpow2(2*m);
P=[P,P];
elseif nargin==3
m=max([AB,CD]);
P=2^nextpow2(2*m);
PQ=[P,P];
else
error('wrong number of inputs')
end
function [PQ,n]=paddedsize(AB,CD,PARAM)
n=nargin;
if nargin==1
PQ=2*AB;
elseif nargin==2 & ischar(CD);
PQ=AB+CD-1;
PQ=2*ceil( PQ/2);
elseif nargin==2
m=max(AB);
P=2^nextpow2(2*m);
P=[P,P];
elseif nargin==3
m=max([AB,CD]);
P=2^nextpow2(2*m);
PQ=[P,P];
else
error('wrong number of inputs')
end
下面的matlab程序错误在哪里?怎么不运行?
matlab 运行下面的程序出现一些错误,请帮忙看看错误在哪里,谢谢.
Matlab程序:错误在哪里
MATLAB程序问题:运行下面的程序,
matlab程序错误 无法运行 哪里有错误 又怎么改正呢
matlab 程序错误,不知道错在哪里,求高人教怎么修改
matlab程序运行出现the statement is incomplete的错误,下面是程序,请问怎样解决
请问下面Matlab程序哪里有问题?运行不出来啊!
matlab二分法,程序运行错误
帮我看一下下面的matlab程序,运行时提示有错误,
下面程序为何在matlab中运行不了啊?
请问下面程序要怎样在MATLAB里面运行出来?