Steve on Image Processing with MATLAB

Image processing concepts, algorithms, and MATLAB

Note

Steve on Image Processing with MATLAB has been archived and will not be updated.

All about pixel colors: Reference information

Note

See the following posts for new or updated information about this topic:

  • MATLAB image display - from data values to pixel colors
  • MATLAB image display - truecolor and indexed images
  • MATLAB image display - scaled indexed images
  • MATLAB image display - grayscale and binary images
  • MATLAB image display - autoscaling values with imshow
  • In this posting I want to summarize all of the factors that control image pixel colors in MATLAB. This information is in the MATLAB documentation, but it is scattered around in several locations. If this is way too much detail for you, that's OK - just come on back next week!

    Contents

    image - CData dimensionality

    • If the image CData is three-dimensional, with the size of the third dimension equal to 3, then the CData values are taken to represent RGB values directly. No other image, axes, or figure properties affect the displayed colors. We sometimes call these "truecolor images."
    • If the image CData is two-dimensional, then the image display colors come from the figure colormap. CData values are used (either directly or in scaled form) as lookup indices into the colormap.

    image - CData class

    • For truecolor images, the class of the CData array (uint8, uint16, or double) affects which values are displayed as white. The triple [0 0 0] is always black. For double CData, [1 1 1] is white. For uint8 CData, [255 255 255] is white. For uint16 CData, [65535 65535 65535] is white.
    • For direct indexed images, the class of the CData array affects the indexing operation. For double CData arrays, the value 1 corresponds to the first colormap color. For uint8 or uint16 CData arrays, the value 0 corresponds to the first colormap color.

    image - CDataMapping

    If the image CData is two-dimensional, then the image display colors come from the figure's colormap, and the image CDataMapping property controls how the colormap lookup is done.

    • If CDataMapping is 'direct', then CData values are used directly as lookup indices into the colormap.
    • If CDataMapping is 'scaled', then CData values are scaled to form lookup indices into the colormap.

    For truecolor images, the CDataMapping property has no effect on the displayed pixel colors.

    axes - CLim

    If the image CData is two-dimensional, and if the image CDataMapping is scaled, then the two-element axes CLim property determines the scaling function. The first element gives the value that maps to the first colormap color, and the second element gives the value that maps to the last colormap color.

    For truecolor images, or if the image CDataMapping property is 'direct', the CLim property has no effect on the displayed pixel colors.

    figure - Colormap

    If the image CData is two-dimensional, then all displayed pixel colors come from the figure Colormap.

    For truecolor images, the Colormap property has no effect on the displayed pixel colors.




    Published with MATLAB® 7.1

    |
    • print

    评论

    要发表评论,请点击 此处 登录到您的 MathWorks 帐户或创建一个新帐户。