zxbmh 发表于 2007-5-25 18:10

请教:图象如何取反

在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, ...

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

[ 本帖最后由 zxbmh 于 2007-5-25 19:07 编辑 ]

zhlong 发表于 2007-5-25 18:14

你是指将黑底白图的转换为白底黑图吗?

zxbmh 发表于 2007-5-25 18:19

黑白的我会了,想知道各种颜色都反色的

eight 发表于 2007-5-25 18:19

原帖由 zxbmh 于 2007-5-25 18:10 发表 http://www.chinavib.com/forum/images/common/back.gif
在MATLAB中如何对图象进行反色处理?没有用过,请教大侠

黑白的话:A = ~A;

zxbmh 发表于 2007-5-25 18:23

=imread('D:\pic\UF2006325103210.jpg')

X =

    map:

>> imshow(I)
>> =imread('D:\pic\UF2006325103210.jpg');
>> map=[',','];
>> X=unit8(255-double(X));
??? Undefined function or variable 'unit8'.

>> X=255-double(X);
>> imshow(X,map)
??? Error using ==> image
TrueColor CData contains element out of range 0.0 <= value <= 1.0.

Error in ==> D:\MATLAB6p5\toolbox\images\images\imshow.m
On line 104==> hh = image(xdata, ydata, cdata, 'BusyAction', 'cancel', ...
找到这段程序,出现这种错误,知道为什么吗?

eight 发表于 2007-5-25 18:28

原帖由 zxbmh 于 2007-5-25 18:23 发表 http://www.chinavib.com/forum/images/common/back.gif
=imread('D:\pic\UF2006325103210.jpg')

X =

    map:

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

1. 是 uint ,不是 unit
2. help imshow

zxbmh 发表于 2007-5-25 18:28

可以写完整一点的程序吗?这个也不知道怎么用?谢谢了:@D

zxbmh 发表于 2007-5-25 18:31

原帖由 eight 于 2007-5-25 18:28 发表 http://www.chinavib.com/forum/images/common/back.gif


1. 是 uint ,不是 unit
2. help imshow
第一条什么意思?不是一样吗?

eight 发表于 2007-5-25 18:33

原帖由 zxbmh 于 2007-5-25 18:31 发表 http://www.chinavib.com/forum/images/common/back.gif

第一条什么意思?不是一样吗?


仔细仔细仔细看

zxbmh 发表于 2007-5-25 18:39

看清楚了,:handshake 谢了.imshow那个可以提下吗?英文的实在..:@L

zxbmh 发表于 2007-5-25 19:02

>> =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-25 19:11

原帖由 zxbmh 于 2007-5-25 19:02 发表 http://www.chinavib.com/forum/images/common/back.gif
>> =imread('D:\pic\UF2006325103210.jpg');
>> map=[',','];
>> X=uint(255-double(X));
>> imshow(X,map)
Warning: Displaying real part of ...


imshow(X,map) displays the indexed
image X with the colormap map. A color
map matrix may have any number of rows, but it must have exactly 3 columns.
Each row is interpreted as a color, with the first element specifying the
intensity of red light, the secondgreen, and the third blue. Color intensity
can be specified on the interval 0.0 to 1.0.

用金山词霸相信足可以搞定

zxbmh 发表于 2007-5-25 19:21

基本上是看懂了,可是还是不知道程序错在哪里,不是我的?
页: [1]
查看完整版本: 请教:图象如何取反