We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpVideo Capture,  Movie Playback,  Vision Libraries › continuous line from tracked motion with jMyron
Page Index Toggle Pages: 1
continuous line from tracked motion with jMyron (Read 537 times)
continuous line from tracked motion with jMyron
Jan 19th, 2010, 10:32am
 
hello there!

i'm trying to visualize motion with continuous lines using the jMyron library.

i only want the show the ongoing motion as a continous line in front of a solid background, not the picture the webcam actually puts out. since the picture is being updated through jmyron, i can't call "background()" in setup, so it wouldn't clear the background in draw. like in the "ContinousLines" example. (sorry not allowed to include links yet)

i'm sort of trying to draw with motion tracking.
hope i make myself clear.

below is the code of what doesn't work very well yet.  Wink


Code:
import JMyron.*;

JMyron theMov;
int[][] globArray;

void setup() {
 size(320, 240);

 theMov = new JMyron();
 theMov.start(width, height);
 theMov.findGlobs(1);
 theMov.trackColor(255, 255, 255, 255);
 
 background(0);
}

void draw() {

 theMov.update();
 int[] currFrame = theMov.image();

 // draw each pixel to the screen
 loadPixels();
 for (int i = 0; i < width*height; i++) {
   pixels[i] = currFrame[i];
 }
 updatePixels();
 

 // draw the glob bounding boxes
 globArray = theMov.globBoxes();
 for(int i = 0; i < globArray.length; i++) {
   int[] boxArray = globArray[i];

   fill(0);
   noStroke();
   rect(0, 0, 320, 240);
   stroke(255, 0, 0);  // red outline
   line(boxArray[0], boxArray[1], boxArray[2], boxArray[3]);
   
 }
}

public void stop() {
 theMov.stop();
 super.stop();
}


help would really be appreciated.

thanks in advance, julian
Page Index Toggle Pages: 1