In this assignment, we were tasked with taking an image of ourselves and putting through some sort of custom filter. This is actually far easier than it sounds, if you think of a picture as essentially being a data matrix where each cell is a 3-tuple containing color information. By looping through all the cells, or pixels, of the image, one can obtain the information from each cell and modify it accordingly. This is the basic format that I used in this project. I ended up doing a few different things. Here is an example of the starting image, with a flipped image next to it:
In total, I ended up making 8 different filter functions. Thats a lot, by the way. I won't go into detail into all of them, because that would be boring as they all have a similar structure. One of the things I worked on for this project was making all of my functions composable with each other. That might be a word I just made up, but it means that I can call each function inside any other function. For instance, I could call flip(pixelate(pmap)), and it would create an image that is pixelated AND flipped about the y axis. I could call twoTone(pixelate(flip(pmap)), 'blue', 'green') and it would create a flipped, pixelated image with only two colors (of my choosing). No really, see:
On the right is the flipped pixelated version, and on the left is the image converted to black and white.
Two functions I am especially proud of are my outline and stripe functions. Outline traces "edges" in an image, where colors change dramatically. I accomplished this by first converting the picture to a "cartoon" format with simpler colors, and then testing the pixels surrounding each pixels for difference in color. In my stripes function, I change the background to two-tone stripes in one direction while the foreground is changed to striped in another direction.
I'm pretty happy with the results.
I made a composite image that contains 6 images using a variety of filters:
And thats that. OH! Wait. I also cut my image in half initially, so all my functions take that into account. So they might need some adjustment to be used on other images.