Friday 5 December 2014

Processing

Colour Capture Cam



Within a recent processing workshop I was working with Declan Barry and Aaron Baker, and through playing with a piece of code that we were given we managed to create a simple yet quite an effective installation. Essentially what the installation is that, using the video processing library, it uses the camera to detect colours in the environment, the code then detects the colour and then updates the pixels on the screen to reflect the colours it sees. 

What the camera sees


What the code changes it to 


Although this is very simple it could work as an installation because as someone passes through the camera the colours that they are wearing will also be picked up and it will cause an update through the work, so that the person would be able to see them self, in colour form, move through the environment.

The Code 

import processing.video.*;
Capture cam;
float blocks=1024;
void setup(){
  size (1024,768);
  cam=new Capture(this,160,120);
  cam.start();
  frameRate(25);
}
void draw(){
  if(cam.available()==true){
    grabPixel();  
  }
}
void grabPixel(){
   cam.read();
   color c;
   float v;
   for (int i=0; i<blocks; i++){
      c=cam.get(int((cam.width*(0.5))/blocks) + int(i*cam.width/blocks),  int(cam.height*0.5));
      v=brightness(c);
      drawBlocks(i,c);
   }
}
void drawBlocks(int i, color c){
   fill (c);
   noStroke();
   rect(width-(i*(width/blocks)),0,0-width/blocks,height); 
}


Declan's blog - https://declanbarrydesign.wordpress.com/
Aaron's blog - http://abaker.co/blog/ 

No comments:

Post a Comment