Matlab plot colors given rgb1/14/2024 ![]() ![]() Question 5: Can you look at different objects of the Flower image (e.g., flowers of different colors, green leaves, and the butterfly) and make sense of the bright or dark values of the red, green and blue components? III. The results of having partial color components mimic what you may see when some R/G/B pin contact of a display connector (such as the VGA traditionally on computers/laptops) becomes loose. You can change to show the results of different orders of adding up the color components. Subplot(1, 2, 2), imshow(img2), title( '1 component: Blue') Hint: If only blue color plane is defined then the image will look as img2 = zeros( size(img1) ) %% initialize arrays of the same size as img1įigure(4),subplot(1, 2, 1), imshow(img2), title( 'Zero Defined Image') Subplot(1, 4, 4), imshow(img2), title( '3 components: RGB') Subplot(1, 4, 2), imshow(img2), title( '1 component: Blue') ![]() Img2 = uint8( img2 ) %% ensure correct data type of unsigned 8-bit integerįigure(3), subplot(1, 4, 1), imshow(img1), title( 'Original') Merging RGB components: img2 = zeros( size(img1) ) %% initialize arrays of the same size as img1 This can be done by defining an image variable, img2, where each of the color planes can be input to the 3rd indexing number. Question 4: Produce the following plot below by merging each of the color planes. Subplot(2, 2, 4), imshow(img1_b), title( 'Blue'), colorbar Subplot(2, 2, 3), imshow(img1_g), title( 'Green'), colorbar Subplot(2, 2, 2), imshow(img1_r), title( 'Red'), colorbar Question 3: Plot each color plane along with the original image in a 2x2 subplot to recreate the image shown below. As an example the red color plane is loaded as img1_r. Question 2: Create a variable to read in the green color plane, img1_g, and another variable that reads in the blue color plane, img1_b. Question 1: Return the size of image one using the size() function 8-bit representation gives a scale of 0 to 255, with 0 being the darkest and 255 the brightness in the particular color component. The overall color image is thus stored in an array of three indexing variables, as you can see in the summary of Workspace in MATLAB, or run the function size.Ī R/G/B component is represented by dafault using 8 bits (unsigned 8-bit integer or 'uint8' in MATLAB data type. The horizontal and vertical dimensions of each color matrix matches the size of the image in unit of pixels. A matrix is essentially an array indexed by two indexing variables typically for row and column.Įach of the three color matrices can be specified by the third indexing number - note the number 1 in the example below img(:,:,1), and so on. In image/video processing, it is also referred to as R/G/B channels. By default, a color image is stored by MATLAB using 3 matrices, each representing red, green and blue components of pixels. ![]()
0 Comments
Leave a Reply.AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |