Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Selecting a Layer: In order to slice off one of the color layers of the image we can use the following command. This command assumes

Selecting a Layer: In order to slice off one of the color layers of the image we can use the
following command. This command assumes that the image has been loaded into a variable
called IMG.
R=IMG(:,:,1);
This example will slice off the first layer which should be the red color layer as we have seen in
the previous challenge and saves it to a variable called R. However you should notice that R is
just a 2D matrix at the moment. MATLAB will interpret this as a grayscale image rather than
being a red color layer. In order to display just the red layer, we will need to create a 3D matrix
with the values in the blue layer and the green layer being set to 0.
IMG, 1), size(IMG,2));
just_red =cat(3,R,a,a);
just_green =cat(3,a,G,a);
just_blue =cat(3,a,a,B);
Displaying a Single Layer: First we will create a 2D array of zeros with the same
dimensions/resolution as the image that we loaded. Then we use the prior example to select
the red layer and save it in R. Then we create a 3D matrix (which will be interpreted as a color
image) and simply set the green and blue layers to be the 0 matrix that we created. This
essentially recreates just the red layer of the image. These steps can be repeated to display just
the green layer and the blue layers.
cat() A function in MATLAB that will concatenate arrays. The first parameter is 3 because we
want to create a 3D array, the next three parameters are the color layers that we want to set.
TASK: PROGRAMMING/PLOTTING Take any image of your choice and load it into MATLAB.
Then using the example above, separate the image into its distinct red, green, and blue layers.
Save these layers to some variables that you can use later. Use imshow() to display the layers
and put screenshots in the write-up.
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

(b) What is the generator for this design? Pg45

Answered: 1 week ago