Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

please assist for python 2 Question 5. (15 points) The below grayscale function converts a color image to grayscale. def grayscale (image): Converts the argument

image text in transcribed

please assist for python 2

Question 5. (15 points) The below grayscale function converts a color image to grayscale. def grayscale (image): Converts the argument image to grayscale."" for y in xrange (image.getHeight(): for x in xrange (inage.ge tilidth(): (r, g, b) = inage.getDixel(x, y) #ast Pixel return tuple of RGB values r = int(r +0.299) # weight each component for human g= intig * 0.587) # perception b = int(b + 0.114) J.uoo = r + g + b image.set.Dixel(x, y, Juno, Juo, Juro) Using the above grayscale function as a model, write a function named invert which makes the image look like a photographic negative. This function expects an image as an argument. For each RGB com- ponent of every pixel, it sets the RGB component to 255 minus the image's original RGB component. def invert (image)

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

Database Processing Fundamentals Design And Implementation

Authors: David M. Kroenke

5th Edition

B000CSIH5A, 978-0023668814

More Books

Students also viewed these Databases questions