注册 登录
编程论坛 Matlab

大家来看看这段错哪了

qzy051203055 发布于 2007-10-06 21:09, 1791 次点击

a=imread('f:\tu.jpg');
j=imnoise(a,'salt&pepper',0.02);
subplot(2,2,1),imshow(a)
subplot(2,2,2),imshow(j)
k=medfilt2(j);
subplot(2,2,3),imshow(k)
运行结果后出现??? Error using ==> imnoise
Unknown noise type: 'salt&pepper'.

Error in ==> e:\MATLAB6p5p1\work\zuoye.m
On line 2 ==> j=imnoise(a,'salt&pepper',0.02);
怎么回事啊啊 还有就是 彩色图象怎么变成黑色的了 要怎么才能显示彩色的呀
帮帮忙 谢谢了各位

6 回复
#2
swayerpan2007-10-07 00:26

salt&pepper改为salt空格 &空格pepper就可以了
显示的那个问题可以试试在参数那里加上map看行不行

#3
qzy0512030552007-10-07 21:05
回复:(swayerpan)salt&pepper改为salt空格 &am...
非常感谢   不过处理后的图片却无法显示出来的 不知道为什么呀 原来图象的和加椒盐后的图象可以显示,但是处理的图象不能显示

[此贴子已经被作者于2007-10-7 21:09:50编辑过]


#4
qzy0512030552007-10-07 21:24

??? Error using ==> e:/matlab6p5p1/toolbox/images/images/private/checkinput (check_attributes)
Function ORDFILT2 expected its first input argument, A,
to be two-dimensional.

Error in ==> E:\MATLAB6p5p1\toolbox\images\images\private\checkinput.m
On line 37 ==> check_attributes(A, attributes, function_name, variable_name, ...

Error in ==> E:\MATLAB6p5p1\toolbox\images\images\ordfilt2.m (ParseInputs)
On line 126 ==> checkinput(A, {'numeric','logical'}, {'2d','real'}, mfilename, 'A', 1);

Error in ==> E:\MATLAB6p5p1\toolbox\images\images\ordfilt2.m
On line 42 ==> [A,order,domain,s,padopt,msg] = ParseInputs(varargin{:});

Error in ==> E:\MATLAB6p5p1\toolbox\images\images\medfilt2.m
On line 53 ==> b = ordfilt2(a, order, domain, padopt);

Error in ==> e:\MATLAB6p5p1\work\zuoye.m
On line 7 ==> k=medfilt2(j,[3,3]);
这是运行完后的结果 到底哪错了咯~~~~~~~~~~~~~

#5
hlongxiang2007-11-04 22:54
k=medfilt2(j);j是三维的好像不行吧,好像只能处理二维的

#6
yato094632007-11-09 11:27
看了这玩意偶就头痛
#7
huruigege2007-11-09 16:44
只能慢慢自己摸索啊,matlab函数太多,只有用的人才会去仔细看help。

多用help才可以的。
1