Monday 1 December 2014

Processing Progress

This weekend I have tested out the "Trackmate" library for Processing which is perfect for my project because it enables webcams to track objects simply by printing out small tags and sticking them to the objects I want to track. This enables me to use physical objects as tools for the user to decrypt my interactive display. I can implement as many track able objects as I want into my project which is great if I want to vary the difficulty of the decryption.

The ways in which my project can be decrypted could either be by rotating the objects much like a briefcase combination lock or by using the values generated by calculating the distance between two objects to change the colour of the background which would therefore reveal a hidden image.

So far i've coded the library in a quite simple way so that I know it's functioning correctly, the sketch at the moment will just fill the background in the colour black until one of the trackable tags are detected by the camera in which case the background would turn white.


// we need to import the LusidOSC library and declare a LusidClient variable
import lusidOSC.*;
LusidClient lusidClient;

// setup: this gets called once when the application starts.
void setup() {
  // setup the processing display window size and type
  size(640,480);

  // Create an instance of the LusidClient. The LusidClient expects
  // an implementation of the 3 LusidOSC callback methods (see below).
  lusidClient = new LusidClient(this);
}

// -------------------------------------------------------------------
// these methods are called whenever a LusidOSC event occurs.
// -------------------------------------------------------------------
// called when an object is added to the scene
void addLusidObject(LusidObject lObj) {
  println("Hello");
}
// called when an object is removed from the scene
void removeLusidObject(LusidObject lObj) {
}
// called when an object is moved/updated
void updateLusidObject (LusidObject lObj) {
}
void draw(){
  // try to get the object if it is present...
  LusidObject lObj = lusidClient.getLusidObject("0x08D03B05BA29");
  if(lObj != null){
    println("Object is present! -- x:"+lObj.getX()+", y:"+lObj.getY());
    background(255,255,255);
  }else{
    println("Object was not found.");
    background(0,0,0);
  }
}


No comments:

Post a Comment