MATLAB中imshow()函数支持输入类型

来源:互联网 发布:java ishexdigit 编辑:程序博客网 时间:2024/06/11 22:55

本文只记录double 与uint8 类型的图像显示

============================================================================

double类型

double类型的图像显示时认为数据在[0,1]的范围,大于1的全部显示为白色;

(所以,图像显示为全白色时,可能你的数据为double类型,而且没有进行归一化到[0,1]之间)


uint8 类型

uint8类型的图像显示时认为数据在[0,255]范围。


double类型与uint8类型之间的转换

image=double(image);

image=uint8(image);

============================================================================


到MATLAB中查找imshow()函数的使用

运行语句:open imshow


函数体中给出的注释

%   Class Support
%   -------------  
%   A truecolor image can be uint8, uint16, single, or double. An indexed
%   image can be logical, uint8, single, or double. A grayscale image can
%   be any numeric datatype. A binary image is of class logical.
%
%   If your grayscale image is single or double, the default display range is
%   [0 1]. If your image's data range is much larger or smaller than the default
%   display range, you may need to experiment with setting the display range to
%   see features in the image that would not be visible using the default
%   display range. For all grayscale images having integer types, the default
%   display range is [intmin(class(I)) intmax(class(I))].
%
%   If your image is int8, int16, uint32, int32, or single, the CData in
%   the resulting image object will be double. For all other classes, the
%   CData matches the input image class.

============================================================================



Reference:

1:http://blog.sina.com.cn/s/blog_6796863701012ipt.html

0 0