zxbmh 发表于 2007-5-30 22:53

程序出错,图象如何取反

请教:图象如何取反

在MATLAB中如何对图象进行反色处理?没有用过,请教大侠

>> =imread('D:\pic\UF2006325103210.jpg');
>> map=[',','];
>> X=uint(255-double(X));
>> imshow(X,map)
Warning: Displaying real part of complex input
> In D:\MATLAB6p5\toolbox\images\images\imshow.m (ParseInputs) at line 503
In D:\MATLAB6p5\toolbox\images\images\imshow.m at line 90
??? Error using ==> real
Function 'real' is not defined for values of class 'struct'.

Error in ==> D:\MATLAB6p5\toolbox\images\images\imshow.m (ParseInputs)
On line 504==>   cdata = real(cdata);

Error in ==> D:\MATLAB6p5\toolbox\images\images\imshow.m
On line 90==> [imtype, cdata, cdatamapping, clim, map, xdata, ydata, filename, ...

谁能告诉最后一步错误原因是什么?谢谢了

eight 发表于 2007-5-30 23:44

原帖由 zxbmh 于 2007-5-30 22:53 发表 http://www.chinavib.com/forum/images/common/back.gif
请教:图象如何取反

在MATLAB中如何对图象进行反色处理?没有用过,请教大侠

>> =imread('D:\pic\UF2006325103210.jpg');
>> map=[',','];
>> ...


估计 X 或者 map 是一个结构体,不符合 imshow 的输入参数要求,建议自己调试一下

berylyl 发表于 2007-5-31 17:10

取反

part1=im2bw(BW_f);
part2=~im2bw(part1);
页: [1]
查看完整版本: 程序出错,图象如何取反