Workshop Task

In a recent workshop we were assigned the task of getting a single pixel colour value from an image. Below I will discuss how I achieved this.

Screen Shot 2015-01-26 at 04.21.56Screen Shot 2015-01-26 at 04.21.32

As you can see above my image of a fish has an orange square in the top left corner. I have done this by creating a pImage variable and assigning the name ‘img’. I have then loaded the image in the setup section by using the loadImage function. I have also created a color variable called ‘c’ and then assigned it to my PImage (img) and used the get function to grab a the pixel which is 200 pixels accross and 200 pixels down. I have then created a rect which has a fill of the color variable c, which is using get to find the pixel colour in the image, resulting in the square being the colour of that pixel.

Screen Shot 2015-01-26 at 04.25.15Screen Shot 2015-01-26 at 04.25.55

Here I have done the same thing but changed the get parameters (highlighted) to 27k,120, which is the fishes eye. As you can see above the rectangle has now changed colour to black.

What I didn’t do in the workshop was work out how to get the colour value of a pixel that is being captured by the camera, though I intend to work this when I next get time.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s