Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Section 4 : Find the Average Color of ANY Image Building off Section 3 , we now want to find the average color of ANY
Section : Find the Average Color of ANY Image
Building off Section we now want to find the average color of ANY image. To do that, we need to create a function that is given a DataFrame image and returns the average
color of that image.
Write this in the function findAverageColor below. You must return the average color as a dictionary with the values:
for the average red color,
avgg for the average green color,
avgb for the average blue color
A dictionary is a data structure that stores multiple values. You have used a dictionary in "Step of your simulation code, where you use to accumulate all realworld values.
Accumulate the values avgr avgg and avgb just like you would in the simulation:
def findAverageImageColorimage:
# Return a dictionary of average color:
d avgr : avgr "avgg: avgg "avgb: avgb
return d
Write the entire findAverageImageColor function to find the average color of the image passed into the function:
def findAverageImageColorimage:
avgr image.rmean,
avgb image.bmean
avgg image.gmean
d avgb: avgb "avgr: avgr "avgg: avgg
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