Question
Create a new function called ExtractLayer: ExtractLayer takes two arguments: image and layer image: a matrix representing an RGB image in the usual RGB image
Create a new function called ExtractLayer: ExtractLayer takes two arguments: image and layer image: a matrix representing an RGB image in the usual RGB image format (we talked about in class on Friday) layer: a number taking values 1, 2, or 3 representing the red, green, and blue layers respectively (you can assume your function always gets valid input) ExtractLayer returns a matrix representing an image with only the requested color layer (with zeros for the other layers) NOTE: your function should return an RGB image matrix (that's why you need zeros in the other layers--there must always be 3 layers to be a valid RGB matrix). To test the correctness of your code, you can try extracting the layers for this image. For instance, the red layer should be what you get if you call imshow(ExtractLayer(image,1))
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started