%Function Name: colorScreen % Inputs (3): - (char) a filename of a foreground im
ID: 3539875 • Letter: #
Question
%Function Name: colorScreen
% Inputs (3): - (char) a filename of a foreground image
% - (char) a filename of a background image
% - (double) a vector of length three of RGB values to replace
% Outputs (1): - (uint8) a uint8 array with the colorScreen effect applied
%
% Function Description:
% Given two images, write a function called "colorScreen" that will
% replace all pixels in the first image that match a given RGB value with
% the corresponding pixels in the second image. For example, if the
% following is called:
%
% colorScreen('img1.bmp','img2.bmp', [0 255 0]);
%
% A uint8 array should be returned that should look like 'img1.bmp', but
% with all of the pure green pixels replaced with the corresponding pixel
% in 'img2.bmp'.
%
% Notes:
% - You do not have to use a for loop in this problem. For loops are a
% very slow and inefficent due to the size of the images that must be
% looped though. Consider logical indexing instead.
% - The two input images will always be the same size.
%
% Test Cases:
% im1 = colorScreen('trex.bmp','ttower.bmp',[0 255 0]);
% imshow(im1)
% => should look like soln1.bmp
% im2 = colorScreen('lookit.bmp','pic.bmp',[237 28 36]);
% imshow(im2)
% => should look like soln2.bmp
Explanation / Answer
very interesting
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.