Tuesday, 13 March 2012

Pixelh8 goes pixelated

Inspired by James Alliban's incredible visual work I have decided to start tinkering with the visual side of Processing more, but from scratch. Instead of tweaking existing code I have begun to write it after working my way through the tutorials. I have never really been interested in the visual side of things but now I have a powerful enough computer I have begun exploring it. Tweaking code is always a good way to learn, but you get a real sense of achievement when you are able to bring your own idea to life, no matter how simple it is. Annotated source code below.

//By Pixelh8

//Imports capture library
import processing.video.*;
//Calls the captured image myCapture
Capture myCapture;

void setup()
//Size of output screen
size(200, 200);
//Name, size and fps of capture screen
myCapture = new Capture(this, 200, 200, 30);

void captureEvent(Capture myCapture) {
//Captures the image

void draw() {
//Displays image so it can be scanned
image(myCapture, 0, 0);
//Check value of pixels and draws 10X10 rectangles in those colours

void DETECT()
for (int y = 0; y < 20; y++){
for (int x = 0; x < 20; x++){
//Tests colour of pixels
color c = myCapture.get(x*10,y*10);
//Sets colour to the colour of the pixel
fill(c); stroke(c);
//Draws the rectangles that colour



  1. A nice little program. One that I have been tempted to try on several occasions. Assuming I am reading it correctly; I am surprised that it works so well just sampling a single point instead of averaging all the pixels in a source square. Will you be updating it to try taking that next step?

    1. Probably won't be updating it as it was just a simple test of the webcam, just to see if I could successfully extract colours from it. It was just a test to get to the "Red Token" sequencer.