Project 6 Ibrahim Riaz CS 151
Skip to end of metadata
Go to start of metadata

Ibrahim Riaz Project Number 6

Abstract:

Project 6 was different from other projects. In this project we learnt not animation but image creation by manipulating pixels on a screen. Pixels are like data points, with each one carrying information in terms of red, blue and green color values. These colors combine to form different colors which when combined together can be used to make any image.This helps us progress and achieve the objectives of project 6 which were to manipulate and create images in the style of Andy Warhol. We do this by creating image filters, manipulating images which are skills transferable to a wider variety of data types. At the end, we're also challenged to be creative and explore what we can do with visual imagery using a variety of tools.

Task 1& 2:

 

 

 

For task 1, we had to create a place image function. This function essentially takes in two inputs, a source and a destination. The purpose of this function is to allow us to move an image and place it onto a different image. We can manipulate the formation of this image, place multiple copies and thereby create a collage.

For Task 2, I tested my place image function using a test file and the miller picture above. Thankfully it worked.

 

Task 3 & 4

For task 3, we build upon our ability to paste pictures and manipulate entire images to manipulate pixels within one image and create photo filters. This is incredibly cool because this was partly the reason behind instagram and snapchat becoming popular nowadays. These filters essentially take in a pixel value and change r, g, b values to change the overall color of pixel and consequently the image.

For my Andy Warhol style image, I chose to create a negative filter, a greyscale filter and a sepia filter.

A greyscale filter essentially is a filter where all r, g, b values are the average of the sum of red, green and blues.

A negative filter is achieved by subtracting the original r,g,b values from 255.

A sepia is achieved by multiplying rgb by specific coefficients which I got from Stack Overflow.

For task 4, I had to create an andy warhol the image which is akin to a collage. As you can see above, I chose the miller image and made three copies, all of which were placed under different filters and then placed onto an empty image.

Task 5

For task 5, we had to learn how to compare pixels and then remove a picture from a green screen and place it onto another image. This demonstrates control by showing us that out of an image file, we can select pixels that satisfy our conditions and copy paster them onto other images. Moreover, we can use this to create new images and scenes.

For this task, I took a picture of a powerpufff girl, Blossom and extracted her from a greenscreen. Once I remover her from the green screen, I paste her against a lake.

 

This is the original image, and this below is after its been placed against a lake with the background removed.

I access each pixel and see if its g and b values are greater than 1.5 times its r values. If yes, then then its not a pixel that gets transferred, others do.

Task 6

For Task 6, we had to do something creative. This involved using what we've learnt in the past projects and make something cool. For my creation, I thought long and hard on what to create. I love music, especially EDM music by Martin Garrix and always wanted him to play at Colby for a spring concert. Therefore I made a paster of him coming to Colby. This poster makes use of the filters, adds texts, flashes the text and has the ability to be modified in terms of its background. You can have a poster that is 2 x2, 4x4 or even 15x15. Whats more one can choose exactly how many filters show up in the poster itself. 

 

 

 

Extensions:

Extension 1:

Creating a List of Filters which can be accessed using controlled randomness. I create additional filters, pile em into a list such that :


 

Moreover, to give the user control, I use command line arguments such that argue[3] refers to the amount of filters involved. 

Extension 2:

Creating a variable poster such that, a user decides the dimensions, in terms of a x a. This controls how many martin garret images are part of the total poster. This is controlled via common lind arguments to create different posters withers using arg[2]


Extension 3&4 (COMMAND LINE ARGUMENTS TO THE MAAAAX):

Adds text that flashes using arg[4], I chose to add "Martin Garrix LIVE AT COLBY" but it could be anything, similarly the user can change the text color using arg[5]. Similarly, I used command line arguments and efficient code to make this a general poster program as opposed to one specifically for martin garrrix. You can use arg[1] to decide what image you wish to use and therefore curate posters for different occasions.

Example, I create a miller poster with text in black that says, "See You Back in the Fall !"



Questions:

The answers to any follow-up questions (there will be 3-4 for each project).

  1. What is a pixel?
    Smallest unit of an image.
  2. What is the difference between an image filename and an Image object
    Image Filename is like an identifier for the Image object and not changeable. An Image object not other hand represents a collection of pixels and is changeable and controllable.
  3. Why are nested for loops useful for manipulating images?
    A nested for loop helps us by allowing us to access each pixel in each row, in every column and edits them without the need to access each of these thousand pixels individually. This vase time writing code and makes it easier to read and edit.
  4. What is your favorite Andy Warhol print?
    Green Coca-Cola Bottles.

Conclusion:

I learnt this week that CS is 99% about the thought behind the process and a little bit of luck. The language we use isn't as important as the way we use it. Understanding the idea that pixels can be understood as the smallest forms of data and seeing the place image function opened up my eyes to the infinite possibilities and control, I can now exert over images. I can create anything by taking one pixel, cloning it, filtering it and placing it in arrangements which is nothing short of crazy.

Acknowledgements:

Bruce Maxwell

A list of people you worked with, including TAs and professors. Include in that list anyone whose code you may have seen, such as those of friends who have taken the course in a previous semester.

A list of any resources that you used.  This includes textbooks, lecture notes, python documentation, library documentation or forums.  If you used a specific website, please link to it.

Put the label cs151s20project# on your wiki page.

Labels
  • No labels