MATLAB image uint8, uint16, double, rgb turn explains the gradation

1.uint8, uint16 with double

To save storage space, matlab provides a special data type uint8 (8 unsigned integer) of the image, the image stored in this manner is referred to as 8-bit image. matlab read image data is uint8, the values ​​generally used in matlab double type (64-bit) operations.

Summarize: uint8, uint16-- storage, display

           Double data calculation processing ---

 

2. Conversion

I = rgb2gray (imread ( 'dog2.jpg'));% grayscale image the image becomes

f = im2double (I);% grayscale double transfected kind - data processing to ensure the accuracy

g = im2uint8 (f);% uint8 image transfer type, generally not by calculation, easy to introduce a rounding error

 

f = double (I);% double () unsigned integer to double precision floating point type double, the data size does not change, the original data is between 0 and 255, or 0 to 255 conversion.
g = im2uint8 (f);% im2uint8 () is converted to double uint8 implemented, if the image data is the matrix type double 0-255, direct im2uint8 () converts words, matlab 1 will be larger than the data are converted into 255,0- 1 only the data between the data mapped to integer between 0 and 255, the image will appear white.
h = uint8 (round (f) );% uint8 () implemented as a double conversion uint8 

3. Why should rgb turn gray?

  1. In nature, the color itself is very susceptible to light, a large rgb change, but the gradient information can provide more information about the nature of
  2. After three channels into a channel operation is greatly reduced
  3. Many opencv function only supports single channel

  What time do not need to turn gray?

       Based on the algorithm, the color itself valuable color for special reasons of environmental samples, such as medical images are red stain

 

 

 

 

 

 

 

 

Guess you like

Origin www.cnblogs.com/xiaoyan-ipython/p/12029626.html