CSC111 Homework 7 2014

From dftwiki3
Revision as of 11:16, 27 March 2014 by Thiebaut (talk | contribs) (Optional)
Jump to: navigation, search


This assignment is due on 3/27/14 evening, at midnight. You can work in pair on this assignment, or individually.


Assignment


  • First observe how Andy Warhol took a picture of Marilyn Monroe and turned it into a work of art:


MarilynWarhol.jpg


  • You are going to apply similar transformations to this picture of a famous local person:


Pres.jpg


Details

  • The picture of President Cathy McCartney is exactly one quarter the size of the full image. The size of her picture is one half the width of the full image, and the height of the picture one half the full height.
  • The file is coded as a jpg file.


Requirements


  • Call your program hw7a.py
  • You need to write a JES program that contains several functions, one function for each basic transformation.
  • Your program will copy the image of the president in the 3 other quadrants, erasing in the process the orange background and the smiley faces. We'll refer to these as quadrant images.
  • The top left image will be the original picture of the president, and will never be affected by any of the transformations.
  • The final image will contain four copies of the president's head. All four heads will be oriented correctly. In other words, none of the heads will be upside down.
  • Your program will put a 5-pixel border all around the full image. The color of the border is up to you.
  • Your program will make one of the quadrant images black and white.
  • Your program will transform one of the quadrant images of the president and divide it into 4 quarters, applying an image transformation to the top-left and bottom-right corners of this image, as illustrated with this picture of the cat below. The type of color transformation you use is up to you. But it should be visible.


QuadrantCat.png


  • The last quadrant image will be a color transformation that will divide the quadrant image into stripes, as illustrated on the cat image below. The type of color transformation you use is up to you. The number of horizontal stripes, and their width are up to you. While the type of color transform is also up to you, it cannot be the same as the transformation used for the image divided into quarters.


StripedCat.png


  • Make sure you document your program well. Each function should have its own header explaining what it does.


  • The image below is an approximation of what your program could output if the top quarter image had been our favorite cat:


FourCats.png


Hints (Added 3/27/14)


Some tips for generating stripes...


Testing


Your program will be tested with a file that will not have the same size as the image with the president and the 3 smileys. But it will have one original photo in the top left corner. Your program should work for any size image, and adapt to the width and height of the image it is given.
You may want to test your program on this image of Miss Piggy to verify that it works well on this image as well.
Be careful that your program should work for images that are taller than they are wider, as well as for images that are wider than they are taller.

MissPiggy.jpg


Submission


Submit your hw7a.py program here. Also submit a copy of the final image you created. It should be called hw7.jpg, or hw7.bmp, or hw7.png, depending on the extension of your image.

Optional


Feel free to use somebody else's picture if you prefer not to work on our president. But if you do, the original picture should contain a real picture in the top-left quarter. This corner picture will be duplicated by your program in the other 3 corners.



...