[Digital Image Processing (II)] classification of images

Source: Internet
Author: User
Tags scale image
In computer systems, images can be divided into gray images, binary images, indexed images, and RGB Images Based on the color and gray scale. In computers, images are usually stored in arrays (or matrices.
Grayscale image:
  • The value range of a gray-scale image matrix element is generally [0,255]. Therefore, the data type is generally 8-bit unsigned integer uint8, which is often referred to as 256 grayscale images. "0" indicates pure black, "255" indicates pure white, and the numbers in the middle are from small to large, indicating the transition from black to white.
  • However, in some fields (such as medical imaging), a dynamic range beyond uint8 is required; uint16 and int16 data types are used;
  • For Gray computing operations (such as Fourier transformation), the double and single types are used. If the image is of the double or single data type, the gray scale image value is usually in the range of [0-1], 0 indicates black, 1 indicates white, and 0 to 1 indicates different gray scale levels. Binary Images can be seen as a special case of grayscale images.
(Note: The image type is completely different from the Data Type of the image. The former represents the image itself, and the latter is only the storage method of the image on the computer)
Binary Image:
  • The two-dimensional matrix of a binary image consists of only 0 and 1 values. "0" indicates black and "1" indicates white. Since each pixel (each element in the matrix) has only 0 and 1 values, the binary image data type in the computer is usually one binary bit.
  • In Matlab, binary images have special significance. Only logical data types [logical] are considered binary images, even an array containing only 0 and 1 (for example, uint8) is not considered a binary image in MATLAB. You can use logical to convert other types of arrays to binary images: B = logical ()

Index image:
  • The index image includes a data matrix X and a color image matrix map. Map is a data array containing three columns and several rows. The values of each element are double-precision floating point data between [0, 1. Each row of the map matrix represents the values of red, green, and blue. In Matlab, the index image is a "direct ing" from the pixel value to the color ing Table value ". The pixel color is indexed by the data matrix X as the index pointing to the matrix map. For example, value 1 points to the first row in the matrix map, value 2 points to the second row, and so on.
  • Generally, index images can only display 256 colors (determined by the value range of data matrix X). Unlike gray images, the values of the gray-scale image color table are continuous values from 0 to 255. Therefore, the gray-scale image data can be regarded as actual pixel values or index values.
  • The advantage of an index graph is that the storage capacity is small, and the index image is generally used to store images with relatively simple color requirements. For example, in windows, the wallpaper with relatively simple color composition is mostly stored with index images, if the color of the image is complex, the RGB true color image is required.
 

Rbg image:
  • RGB Images and indexed images can be used to represent color images. Like an indexed image, it uses a combination of three primary colors: red (R), Green (G), and blue (B) to represent the color of each pixel. However, unlike the index image, the color values of each pixel in the RGB image are directly stored in the image matrix;
  • The color of each pixel must be represented by three components: R, G, and B. An RGB image with a size of M * n needs three matrices of M * n, each matrix represents a color channel. The data type of RGB Images is generally uint (or double), which is usually used to represent and store real-color images (with 2 ^ 24 colors ), of course, you can also store grayscale images (gray images are used if the values of the three channels are the same ).
  • 3-channel color image synthesis using cat in MATLAB: rab_image = CAT (3, R, G, B );
  • Use the following commands to extract images from three channels:
    • R = rgb_image (:,:, 1 );
    • G = rgb_image (:,:, 2 );
    • B = rgb_image (:,:, 3 );














Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.