Question: 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

 please assist for python 2 Question 5. (15 points) The below

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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!