Summary: In this project, you will help the user do some basic image transformations.
Due dates:
Because of the graphics libraries this project uses, you will need to do the project on your own computer or in the labs. You will need the following files to be in the same directory as your code:
Before you start coding, you should read the Image documentation and contents of the Image class provided in graphics.py. Read the description of these functions very, very carefully and ask questions early -- understanding what these methods do will save you a lot of time.
You should modify the image in accordance with the user's menu choice. This section describes the 3 transformations you should implement.
Note: The image library is pretty slow. Each of these functions may take some time to run.
All of the examples shown start with the sample image below:
For this transformation, you should loop over all of the pixels of the input Image. For each pixel, you should set the red, green, and blue values equal to their old values subtracted from 255. Use setPixel to save the modified pixel into the Image object.
Example output:
Modify the fields of each pixel according to the following formulas. Note that these formulas are not written directly in Python code!
new red = (old red * .393) + (old green * .769) + (old blue * .189) new green = (old red * .349) + (old green * .686) + (old blue * .168) new blue = (old red * .272) + (old green * .534) + (old blue * .131)
If any of the new values exceeds 255, set it equal to 255.
You will need to convert these values to integers before attempting to create the pixel.
Sample output:
Split the image up into at least 4 pieces of equal size (or as close to equal as the image dimensions allow).
Rearrange these pieces so that no piece remains in its original location. At least one piece should move horizontally, and at least one piece should move vertically.
Here is an example:
For the checkpoint, you should be able to demonstrate all of the functionality from the "The Input File" and "Processing Steps" sections of the specification.
You do not need to actually implement any of the transformations yet -- you can just instead pause the program for 3 seconds to simulate the amount of time for the transformation to take place. For this purpose, import the time library and use time.sleep(3).
For extra credit, you can support additional transformations and add these in the main menu itself. Example transformations could be to smooth the image or getting edges in the image. If you need help brainstorming additional transformations, feel free to ask!
The grading and style guidelines from Project 2 apply to this project as well. The full grading rubric is posted at cs115_p3_rubric_full.html
60% of your grade will be on the correctness of your program. You will not get full credit for this 60% unless your output contains the required information.
Another 30% will be on your programming design and style. “Programming design” means that your code shows a logical, straightforward breakdown of the problem. “Programming style” means that you obeyed certain rules to make your program easier for yourself and others to read.
Note that you are REQUIRED to divide your code for this project into functions. You do not have to design your own classes.
The final 10% of your grade will be the checkpoint. The checkpoint cannot be submitted late.
You should submit your final code on Moodle by the deadline. As a backup, I strongly encourage you to upload a copy to your cwolf directory in case something goes wrong with your submission to Moodle.
Please name your file yourlastnameP3.py, substituting your actual last name (in lowercase) as indicated.
You only need to submit your own Python file. I will use my own copy of the graphics library and my own test images.
Programming projects must be your own work, and academic misconduct is taken very seriously. You may discuss ideas and approaches with other students and the course staff, but you should work out all details and write up all solutions on your own. The following actions will be penalized as academic dishonesty:
There is a 48-hour grace period associated with the final project deadline. This grace period is designed to cover small personal emergencies and other unexpected events. No other consideration will be given for these small emergencies.