cathjj05
2009-04-13, 10:21
加噪总是出错,程序如下,不知何处有问题
load woman2;
subplot(2,2,1),imshow(X,map); %读取并显示图像
X1=imnoise(X,'salt&pepper',0.06);
X2=double(X1)/255;
h1=[1/9 1/9 1/9;1/9 1/9 1/9;1/9 1/9 1/9];
J1=conv2(X2,h1,'same'); %低通滤波
J2=medfilt2(X2,[3 3]); %中值滤波
subplot(2,2,2),imshow(X1);
subplot(2,2,3),imshow(J1);
subplot(2,2,4),imshow(J2);
这里是出错提示
??? Error using ==> imnoise>ParseInputs
A valid double image must have values between zero and one.
Error in ==> imnoise at 80
[a, code, classIn, classChanged, p3, p4] = ParseInputs(varargin{:});
load woman2;
subplot(2,2,1),imshow(X,map); %读取并显示图像
X1=imnoise(X,'salt&pepper',0.06);
X2=double(X1)/255;
h1=[1/9 1/9 1/9;1/9 1/9 1/9;1/9 1/9 1/9];
J1=conv2(X2,h1,'same'); %低通滤波
J2=medfilt2(X2,[3 3]); %中值滤波
subplot(2,2,2),imshow(X1);
subplot(2,2,3),imshow(J1);
subplot(2,2,4),imshow(J2);
这里是出错提示
??? Error using ==> imnoise>ParseInputs
A valid double image must have values between zero and one.
Error in ==> imnoise at 80
[a, code, classIn, classChanged, p3, p4] = ParseInputs(varargin{:});