Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Code in MATLAB Introduction RGB color images in MATLAB are a 3-D arrays, split into 3 layers: Red, Green and Blue corresponding to the first,
Code in MATLAB
Introduction RGB color images in MATLAB are a 3-D arrays, split into 3 layers: Red, Green and Blue corresponding to the first, second and third array layers, respectively. In this project, an image of Rubic cube is given and you will have to swap colors in this image. Part 1 Load an image of Rubic cube to the workspace from the file "Rubik_cube.png". Images are loaded using the command imread('lmage_name.png). Assign the 3-D array to a variable for further processing. Part 2 Write a function called swap to implement the color swapping process. function out swap(in, c1, c2) %% your work here % ci are layers to swap, the values of which are 'R, 'G' and 'B. % in is the input image, the original Rubic cube. % out is the output color swapping image. end In this function, use two switches to determine which colors need to be swapped assigning numbers 1 to 3 to a variable that describes the layer. Create the output image by exchanging the colors from the input imge. Third, make sure the layer that remains without change is saved into the output image. . Part 3 Consider all the swapping cases and generate the corresponding figures. There are three switching cases: swapping red and green, swapping red and blue, swapping green and blue Use subplot to generate the figures of original cube and three swapping cases. The swapping images should be generated by calling function defined in part 2. Here is an example: figure; subplot(2,2,1) imshow(lmCube); title(Original); subplot(2,2,2) imshow(swap(ImCube,'R,'G')); title(Red/Green Swapped')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