Gradient Illusion

You will create the illusion below:

Gradient Illusion

Problem 4.1: Create Your Illusion

In this case, the background is a gradient with grey colors ranging from a brightness of 0 to 255. The rectangle on top is a single mid-intensity grey, and the color does not change.

You should create a function that returns a MiddImage with a gradient illusion:

def optical_illusion(im):
    # TODO: create a gradient illusion

You will probably find it useful to use two of the functions that you created earlier for this assignment: straight_line and filled_rectangle.

Your function must work with the size of im that is used in the test function. You must use loops in your code, do not hard-code individual pixels!

Problem 4.2: Set the ILLUSION Variable

In order to identify which illusion you have created, set the variable in your code as follows:

ILLUSION = "gradient"

Problem 4.3: Reflection

Please answer the following question under the header Problem 4.3: illusion reflection:

How many times did you call the straight_line function in your code? Base your answer on the image that is generated using the test function call in hw5.py.

If you did not call straight_line in your code, it is OK to simply state that.