![]() The black region in the image shows pixel values that contain no red values, i.e., R = 0. As red becomes mixed with green or blue, gray pixels appear. For example, in the Red Plane image, the white represents the highest concentration of pure red values. The white corresponds to the highest values (purest shades) of each separate color. Notice that each separated color plane in the figure contains an area of white. RGB=reshape(ones(64,1)*reshape(jet(64),1,192),) įigure 2-5: The Separated Color Planes of an RGB Image.It displays each color plane image separately, and also displays the original image. To further illustrate the concept of the three separate color planes used in an RGB image, the code sample below creates a simple RGB image containing uninterrupted areas of red, green, and blue, and then creates one image for each of its separate color planes (red, green, and blue). ![]() To determine the color of the pixel at (2,3), you would look at the RGB triplet stored in (2,3,1:3). For example, the red, green, and blue color components of the pixel (10,5) are stored in RGB(10,5,1), RGB(10,5,2), and RGB(10,5,3), respectively.įigure 2-4 depicts an RGB image of class double.įigure 2-4: The Color Planes of an RGB Image The three color components for each pixel are stored along the third dimension of the data array. A pixel whose color components are (0,0,0) displays as black, and a pixel whose color components are (1,1,1) displays as white. In an RGB array of class double, each color component is a value between 0 and 1. The precision with which a real-life image can be replicated has led to the commonly used term truecolor image.Īn RGB MATLAB array can be of class double, uint8, or uint16. This yields a potential of 16 million colors. Graphics file formats store RGB images as 24-bit images, where the red, green, and blue components are 8 bits each. The color of each pixel is determined by the combination of the red, green, and blue intensities stored in each color plane at the pixel's location. You can use ColorSpec anywhere you need to define a color.Introduction (Image Processing Toolbox) Image Processing ToolboxĪn RGB image, sometimes referred to as a truecolor image, is stored in MATLAB as an m-by-n-by-3 data array that defines red, green, and blue color components for each individual pixel. These statements generate equivalent results: They are referred to as fixed colors, as opposed to colormap colors.Įxamples To change the background color of a Figure to green, specify the color with a short name, a long name, or an RGB triple. Remarks The eight predefined colors and any colors you specify as RGB values are not part of a Figure's colormap, nor are they affected by changes to the Figure's colormap. The following table lists the predefined colors and their RGB equivalents. For example, you can specify a shade of pink as 1 0.5 0.8. The intensities must be in the range 0,1. The RGB triple is a three-element row vector whose elements specify the intensities of the red, green, and blue components of the color the intensities must be in the range. RGB Triplet Create a custom color by specifying a three-element row vector whose elements are the intensities of the red, green, and blue components of a color. The short names and long names are MATLAB strings that specify one of eight predefined colors. ColorSpec (MATLAB Function Reference) MATLAB Function Referenceĭescription ColorSpec is not a command it refers to the three ways in which you specify color in MATLAB:
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |