Instructions:
Point the camera at a white background and make a dark silhouette with your hand. you should see your hand converted to a vector-based shape and rerendered in green outline.
import JMyron.*;
JMyron m; //a camera object
void setup(){
size(320,240);
m = new JMyron(); //make a new instance of the object
m.start(width,height); //start a capture at 320x240
m.minDensity(100); //minimum density - you'll need to tweak this, probably.
m.trackColor(0,0,0,150); //color to track, and tolerance. need to tweak this as well.
println("Myron " + m.version());
noFill();
}
void draw(){
// GET THE IMAGE PIXELS
m.update(); //update the camera view
int[] img = m.image(); //get the normal image of the camera
loadPixels(); //load the pixels[] array
for(int i=0 ; i < width*height ; i++) //loop through all the img pixels
pixels[i] = img[i]; // copy to pixel to be displayed
updatePixels(); // show pixels[] on the screen
// DRAW THE OUTLINES
stroke(0,150,0); // set stroke color
int[][][] list = m.globEdgePoints(30); //get the outlines
for(int i=0 ; i < list.length ; i++) {
beginShape(LINE_LOOP);
if(list[i]!=null)
for(int j=0 ; j < list[i].length ; j++)
vertex(list[i][j][0],list[i][j][1]);
endShape();
}
}
void mousePressed(){
m.settings(); //click the window to get the settings
}
public void stop(){
m.stop(); //stop the object
super.stop();
}