Answered step by step
Verified Expert Solution
Link Copied!

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 4: Find the Average Color of ANY Image
Building off Section 3, 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:
avg-r, for the average red color,
avg_g, for the average green color,
avg_b, for the average blue color
A dictionary is a data structure that stores multiple values. You have used a dictionary in "Step 4" of your simulation code, where you use d to accumulate all real-world values.
Accumulate the values avg_r, avg_g, and avg_b just like you would in the simulation:
def findAverageImageColor(image):
...
# Return a dictionary of average color:
d ={"avg_r" : avg_r, "avg_g": avg_g, "avg_b": avg_b}
return d
Write the entire findAverageImageColor function to find the average color of the image passed into the function:
def findAverageImageColor(image):
avg_r = image.r.mean,
avg_b = image.b.mean(),
avg_g = image.g.mean ()
d ={"avg_b": avg_b, "avg_r": avg_r, "avg_g": avg_g
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

SQL Database Programming

Authors: Chris Fehily

1st Edition

1937842312, 978-1937842314

Students also viewed these Databases questions

Question

What is the most important part of any HCM Project Map and why?

Answered: 1 week ago