Yusheng's project 4
Skip to end of metadata
Go to start of metadata

This week's project primarily focus on manipulating the pictures. Our task is to create a Warhol image by using different filters. 
The first project is to make a warhol collage. To make this graph, I first set up the display window which is 2*width of the original graph wide and 2*height of the the original graph high. Then I make four clones of the original photo and apply filter function on each clone.

As you can see, the four filters are to make photo .

The final graph looks like this

The frist filter is  "reverse filter" which change the color value of every pixels to the reverse side (255 - value) 

The second filter is "black and white filter" which changes the photo to black and white

The third filter is  "swap green and blue " filter, which swaps the "green" value and "red" value of every pixels.

The forth filter is "mosaic" filter. I takes the average color value of every 9 pixels in the photo so that every photo seems "blurred" than before.
if _name_ == "_main_": main( sys.argv )
                        Required image 1
The second graph is to change the "very green" background to other color.

The photo below is the original photo:

Then I change the background to a very interesting graph (for extesion):

To make this happen, I first loop out color values of  all pixels in the graph. I wrote function that python would collect all pixels whose "green" value is much bigger than the "red" value. Then I change all collected pixels to this multicolour background. Then, python would create new file called "yusheng.ppm". To read this file, I can use python show.py to open ppm picture.

For the extensions, I rearrange the warhol graph to a more interesting graph and I also  change the filter functions. 

The upper photo on the left is made by "reverse filter" which change the color value of every pixels to the reverse side (255 - value) 
The upper photo on the left is made by "black and white filter" which changes the photo to black and white
The middle photo on the left is made by "swap green and blue " filter, which swaps the "green" value and "red" value of every pixels
The photo in the middle is made by "mosaic" filter. I takes the average color value of every 9 pixels in the photo so that every photo seems "blurred" than before
The two photo on the bottom are made by "symmetry" filter. I replace the left side (the lower side) of the photo by a symmetry of the right side (upper side) 

Then python would create a window and put all pictures inside the window (but the width of the first picture must be bigger than the second picture). Users can control pictures that they want to put in python command line. Python would create a new ppm file called "filter.ppm". And then I use show.py to read the picture.

                           Extension image 1


                  bigger version of middle picture 

For the second extension, I change the background of my image to multi-colored background. I also change the background to another scene. As shown in the picture shown below, I change the background to a desert scene! To make this happen, I write up a code that can make python collect all the pixels whose green value is lower than 2.5*red value and I import all those pixels to a new graph, which is the desert scene. Then python would make a yushengscene.ppm file of the picture I created. Then I import "show.py" file to read the yushengscene.ppm

.
                               Extension 2

Labels