Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Matlab practice Write a custom MATLAB function named pixelcounter that counts the number of pixels in a user - specified image that have an intensity
Matlab practice
Write a custom MATLAB function named pixelcounter that counts the number of pixels in a user
specified image that have an intensity exceeding a userspecified threshold value in a userspecified
colour channel. The pixelcounter function has the following three inputs:
img: the image on which the user wishes to apply the pixelcounter function
clr: the colour channel the user is interested in; specified as for red, for green, or for blue
lim: the threshold intensity value in the specified colour channel
And the following three outputs:
num: the number of pixels exceeding the value specified by lim in the colour channel specified
by
perc: the percentage of pixels exceeding the value specified by lim in the colour channel
specified by calculated out of the total number of pixels in img
avg: the average intensity value for all pixels in the colour channel specified by clr
Note:
You may assume that the user will always supply inputs that are valid there is no need to
account for any invalid inputs eg clr being set to
The Learner Template has hints on how to approach writing this function. You may choose to use
these or pursue coding the function however you like, but your solution should feature the use of
ifelse statements and for loops.
Use the sample images to test the function given in the transcript : 'BrightonBeach.jpeg', ;Barbie.jpeg', 'Cats.jpeg' and 'Dune.jpeg'
Use semicolon ; to suppress code output
Do not use any clear or clc commands in the script.
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