Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a function that takes three strings as input, redFile, greenFile and blueF

ID: 3572744 • Letter: W

Question

Write a function that takes three strings as input, redFile, greenFile and blueFile, and returns a single output, compImg, an m times n times 3 unit 8 as an output. It should do the following. Use csvread to import the data from redFile, greenFile and blueFile, and assign that data to three variables. You can assume that each file contains an m times n matrix of numbers. Convert the data from each file into the uint8 data type. compImg should be color image containing the converted data from redFile as the red component of the image, the converted data from greenFile as the green component of the image, and the converted data from blueFile as the blue component of the image.

Explanation / Answer

Here is the code for you:

function compImg = CombineColorsOfImage(redFile, greenFile, blueFile)

%Imports data from all the three files into three variables.

redChannel = uint8(csvread(redFile));

greenChannel = uint8(csvread(greenFile));

blueChannel = uint8(csvread(blueFile));

compImg = cat(2, redChannel, greenChannel, blueChannel);

end

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote