. This is how I select every single pixel in the image. If I want to manipulate every single pixel in an image, I need to use this loop.
I created following filters for the required part of the project: darker, blackAndwhite, and sepia. Below are results, respectively. The first is the original image.
Image Added Image AddedImage AddedImage Added Image Added.
The darker filter makes the image look darker by decreasing RGB values by same factor. If RGB value gets closer to zero, it will become darker. If all RGB values are zero, then the entire image would be black. Vice Versa.
The blackAndwhite filter works by averaging the RGB values and assigning the result to value to all three RGB values and pixels in the image.
The sepia filter multiplies the RGB values by the factor of value that would create sepia color (112, 66, 20).
I am not going to talk about swapRedBlue filter because it was created during lab.
Now I have to create Warhol program that would put those four filter images in a new blank image that is width*2 by height*2. Think a new blank image as a picture frame.
Here are the steps of how Warhol program works: 1) constructs an image from contents of the given file, i.e. arg, which means the user input. 2) make four copies of the image using clone() command. 3) apply the four filter programs to the four copies. 4) then create the picture frame. 5) put or place the four filtered images into the picture frame by using placeImage() function that was created in the first step of the project. 5) finally, save the result to a new file. The end-result would look like below.
Blue Screen Effects:
This task is basically about creating a filter that would manipulate specific pixels by using conditional statement.
Compare this with the loop command in the earlier part of this write-up. The difference is that the filter would only apply to the pixels which g value is 1.7 times the red value and bigger than the blue value. I added this condition because all I wanted to manipulate were the very green pixels of my background image.
Image Added Image Added. Note how the green pixels only turned into red pixels.
For following extensions,
- Create a larger or more complex Warhol style collage. Place the images in a pattern more complicated than that of a square (but not random!).
- Enable your Warhol program to read in multiple images from the command line and make a collage for each one, or a collage that integrates several images.
I created a bigger collage, still-square looking. However, my end-result does not look like a square because I did not fill up the entire collage. The key is to calculate where each image will be placed within the collage. Image Added.
Another difference is the number of images I am copying within the program because I want to enable my Warhol program to read in multiple images. Here is the solution:Image Added . Simple. The rest is very similar with the original Warhol program. I just copy more images, apply more filters to those images and then place them in the collage. Below is the result.
. I did create two more filters for this extension: cooler and negative. Cooler filter, which is the flower image that looks darker, literally cools down the image by decreasing r and g values.(the bright colors) Here is how the filter would change another image.
Image Added. The negative filter basically subtracts the rgb values from 255 individually. Intuitively, this filter would basically witch the RGB values upside-down. In other words, the bright colors would turn dark and vice versa.
For the following extensions,
- Do something more interesting than a single color to replace the blue screen.
- Place yourself in a scene. Start with a background scene that is the same size image as your blue-screen image. Then copy only non-blue pixels from your images into the background. You can do this by making a version of placeImage that copies only non-blue pixels. You could call it placeImageWithoutBlue.
I created two more filters to manipulate the background of my own image. Again, the conditional statement and filter are the key.
Image Added. For this image, I manipulate the very-green pixels to have random values of RGB.Image Added. Simple but interesting effect.
Image Added. This image is a bit more complicated than a simple filter function. Rather than manipulate the background pixels, I actually copied the non-green pixels to the source image, the X-ray image. Thinks of this as combination of placeImage and filter function.
Note that the conditional statement I used for this image is the opposite of what I wrote for blue screen effect. The reason is that the pixels I am targeting are the exact opposites.Image Added.
Reflection: This project was very tough initially without understanding how Zelle graphics works. The lab does give a foundation for the project; however, understanding of graphics library is a 'must.' What I mean by that is that I needed to understand the process of creating image, selecting certain pixels, giving certain color to those pixels, applying filters to different images, and placing those filtered images to one image using functions I created through the project. I think this holistic understanding was essential to completing this project.
Sources, imported libraries, and collaborators: I did not borrow anyone's code for this project; however, I got extensive help from professor Skrien and Selim, one of the TAs.