im2uint8函数
将图像转换为8位无符号整型。也可将输出值限定在[0 255]内。
function u = im2uint8(varargin)
%IM2UINT8 Convert image to 8-bit unsigned integers.
% IM2UINT8 takes an image as input, and returns an image of class uint8. If
% the input image is of class uint8, the output image is identical to it. If
% the input image is not uint8, IM2UINT8 returns the equivalent image of class
% uint8, rescaling or offsetting the data as necessary.
%
% I2 = IM2UINT8(I1) converts the intensity image I1 to uint8, rescaling the
% data if necessary.
%
% RGB2 = IM2UINT8(RGB1) converts the truecolor image RGB1 to uint8, rescaling
% the data if necessary.
%
% I = IM2UINT8(BW) converts the binary image BW to a uint8 intensity image,
% changing one-valued elements to 255.
%
% X2 = IM2UINT8(X1,'indexed') converts the indexed image X1 to uint8,
% offsetting the data if necessary. Note that it is not always possible to
% convert an indexed image to uin