# hw6.py - Ayo Osonowo Osono003 Part 1 Inversion#= Purpose...

• No School
• AA 1
• 3

This preview shows page 1 - 2 out of 3 pages.

## Ayo Osonowo ## Osono003 # Part 1: Inversion #========================================== # Purpose: # Inverts the colors of an image # Input Parameter(s): # A 3D matrix (list of lists of lists) representing an .bmp image # Each element of the matrix represents one row of pixels in the image # Each element of a row represents a single pixel in the image # Each pixel is represented by a list of three numbers between 0 and 255 # in the order [blue, green, red] # Return Value: # A 3D matrix of the same dimensions, with all colors inverted # (that is, for every value x in the input matrix, the output matrix # should have 255-x in that spot). #========================================== def invert(img_matrix): for i in range(len(img_matrix)): print("Not Yet Implemented") return img_matrix # Part 2: Grayscale #========================================== # Purpose: # Converts an image to grayscale # Input Parameter(s): # A 3D image matrix (see part 1) # Return Value: # A 3D matrix of the same dimensions, where each pixel has all components # (red, green, blue) set to the average of the three components in the # original pixel, rounded down if necessary #========================================== def grayscale(img_matrix): print("Not Yet Implemented")

Subscribe to view the full document.

• Fall '19

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern

Ask Expert Tutors You can ask 0 bonus questions You can ask 0 questions (0 expire soon) You can ask 0 questions (will expire )
Answers in as fast as 15 minutes