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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!