Question
(MATLAB) In this problem, you will create two function files that both perform the same task turning a color image into a black and white
(MATLAB)
In this problem, you will create two function files that both perform the same task turning a color image into a black and white image based on a given threshold value. Every pixel in the original image that is brighter than the threshold value should be set to white. Every pixel in the original image that is darker than the threshold value should be set to black. Assume that pixel brightness is represented by the average of the R, G and B values.
Your ThresholdImage1.m should utilize logical arrays to do the image processing. Your ThresholdImage2 function should use nested for loops to do the image processing. Both functions will have the same inputs and output:
Inputs: (1) RGB image array, (2) scalar threshold value
Output: Modified RGB image array
In a new cell in your HW10.m script:
Read in an image (of your choice, or you can download and use BB-8.jpg from Canvas)
Call your ThresholdImage1 function
Display the original and thresholded images side-by-side in a single figure window
Call your ThresholdImage2 function
Display the original and thresholded images side-by-side in a new figure window
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