Rose-colored glasses
The roseColoredGlasses function takes a picture, cycles through all the pixels and decreases that pixels green and blue values. The result is that the picture takes a pinkish tint as if looking through rose colored glass.
Before
|
After
|
Code
|
Negative
The makeNegative function takes the red, green and blue values and subtracts them from the max rgb value of 255 so that the color of each pixel is switched. The result is the creation of an image that looks like the negative of the original image.
Before
|
After
|
Code
|
Better black and white
The betterBnW function cycles through the pixels of a picture and balances the rgb values to get the luminance of each pixels. This value is then set to the individual rgb values of the target pixels resulting in a very clean black and white image.
Before
|
After
|
Code
|
Bottom-to-top mirror
The bottomToTop function takes an image and cycles through the bottom of the image. It then copies the color of each pixel and sets that color to the pixel opposite it on the top half of the image. This results in a mirroring of the image about the center.
Before
|
After
|
Code
|
Shrink
The shrink function takes an image and creates a blank image that is half the length and width of the original image. It then copies every other pixel from the original to the copy resulting in a shrunken copy of the original.
Before
|
After
|
Code
|
Collage
The collage allows you to choose images that will be modified using previously created functions and places these images throughout a page sized image.
Results
|
Code
|
Red-eye Reduction
The removeRedEyeFromPicture function cycles through the pixels in an image and compares the pixel to a few different red colors. If the color is close enough to the red we are looking for, the original pixels color is changed to black, thus fixing the red eye.
Before
|
After
|
Code
|
Color Art-i-fy
The artify function takes the pixels from an image and checks their individual rgb values. Depending on the original values, it will then set the pixels to either a low, medium, or high rgb value. This results in an artistic image in which the colors take on an intense appearance.
Before
|
After
|
Code
|
Green screen
The greenScreen function takes a front image and a background image. It then cycles through the front image and if the pixels is close to a green color, it does not copy that pixel onto the background image. If the pixel is not green however, then it will copy the pixel at the same location onto the background image, thus combining the two.
Before
|
After
|
Code
|
Homemade St. Patrick's Day
The stPatrickCard function takes three images, it first goes through the clover image and if the individual pixel is green, then it copies the pixel into the top right corner of the base image. After that it goes through the cat picture and if the individual pixel in the cat is not white copies the pixel into the bottom left of the base picture. After that the function writes a “Happy St. Patrick’s Day!” into the center of the image. The resulting card is written into the directory and displayed.
Card
|
Code
|
Line Drawing
For the lineDrawing program I used two functions, one to figure out and return the luminance of an individual pixel and the other to actually do the line drawing modification. After cycling through the pixels in the picture we check the pixel to the right and under the pixel we grabbed, we then use the luminance function to compare the luminance of the pixels and decide whether to make the pixel we are focused on black or white.One problem I faced while working on this function was to be sure and check if we had reached the greatest x or y value possible for the picture, otherwise we would be attempting to grab pixels that did not exist for comparison. If this occurred, I made the non-existent pixel point to the pixel we were currently looking at since there would be no difference in luminance.
Before
|
After
|
Code
|