The question is "
Anyone has any luck working with two cameras with JMyron or Video library?"
I wrote the following code to run 2 (two) cameras and track the color to move (each camera) a video in a projection. Nevertheless, it is not running...
Any advice or ideas???
Clarissa
/**
*test version 01/ alternative code using JMyron
* Entangled v.01 // an interactive video installation //THE DOUBLE collective, Brazil, September 2012; processing code: Clarissa Ribeiro
almeida.clarissa@gmail.com
* Clarissa Ribeiro: artistic direction, video and sound capture and edition;
* Renata La Rocca: artistic direction and tests;
* Maurcio Taveira: video capture and edition; artistic collaboration;
* Milena Szafir: artistic colaboration;
*look into an eyetracking device (adapted webcam) to load and play a movie file.
*/
import fullscreen.*;
import processing.video.*;
import JMyron.*;
import ddf.minim.*;
Minim minim;
AudioPlayer player;
FullScreen fs;
Movie myMovie;
JMyron m; //a camera object
Movie myMovie2;
JMyron m2; //a second camera object
//variables to maintain the floating movie
float myMovie2x = 320;
float myMovie2y = 240;
float myMovie2destx = 320;
float myMovie2desty = 240;
//variables to maintain the floating moviee
float myMoviex = 320;
float myMoviey = 240;
float myMoviedestx = 320;
float myMoviedesty = 240;
void setup() {
// set size to 640x480
size(640, 480);
// The background COLOR IS BLACK:
background(0,0,0);
//new Minim:
minim = new Minim(this);
// load a file, give the AudioPlayer buffers that are 2048 samples long
player = minim.loadFile("breathing.wav", 2048);
player.loop();
// Create the fullscreen object
fs = new FullScreen(this);
// enter fullscreen mode
fs.enter();
// Load and play the video in a loop// according to the sculpture dimmension, change the video file: medium, big or small, or use the original.mov
myMovie = new Movie(this, "mauricio_ojos.3gp");
myMovie.loop();
m = new JMyron();
m.start(width, height);//start a capture at 640x480
m.trackColor(255,255,255,256*3-100);//track white / must ajust the 3-5
m.update();
m.adaptivity(10); // how fast the white is capted! it was 100
m.adapt();// immediately take a snapshot of the background for differencing
println("Myron " + m.version());
rectMode(CENTER);
noStroke();
myMovie2 = new Movie(this, "mauricio_ojos2.3gp");
myMovie2.loop();
m2 = new JMyron();
m2.start(width, height);//start a capture at 640x480
m2.trackColor(255,255,255,256*3-100);//track white / must ajust the 3-5
m2.update();
m2.adaptivity(10); // how fast the white is capted! it was 100
m2.adapt();// immediately take a snapshot of the background for differencing
println("Myron " + m2.version());
rectMode(CENTER);
noStroke();
}
void movieEvent(Movie myMovie) {
myMovie.read();
}
void movie2Event(Movie myMovie2) {
myMovie2.read();
}
void drawCamera(){
loadPixels();
updatePixels();
}
void drawCamera2(){
loadPixels();
updatePixels();
}
int[][] centers = m.globCenters();//get the center points
//draw all the dots while calculating the average.
float avX=0;
float avY=0;
for(int i=0;i<centers.length;i++){
fill(0);
// image(myMovie, 0,0);
avX += centers[i][0];
avY += centers[i][1];
}
if(centers.length-1>0){
avX/=centers.length-1;
avY/=centers.length-1;
}
//draw the image. if you want the movie starts in the center of the screen, use myMoviex/2 and myMoviey/2.
// to star in the right corner: only myMoviex and myMoviex. To start in the left, myMoviex/4 and myMoviexy/4.
image(myMovie, myMoviex, myMoviey);
//update the location of the thing on the screen.
if(!(avX==0&&avY==0)&¢ers.length>1){
myMoviedestx = avX;
myMoviedesty = avY;
}
myMoviex += (myMoviedestx-myMoviex)/1f;
myMoviey += (myMoviedesty-myMoviey)/1.f;
}
int[][] centers = m2.globCenters();//get the center points
//draw all the dots while calculating the average.
float avX=0;
float avY=0;
for(int i=0;i<centers.length;i++){
fill(0);
// image(myMovie, 0,0);
avX += centers[i][0];
avY += centers[i][1];
}
if(centers.length-1>0){
avX/=centers.length-1;
avY/=centers.length-1;
}
//draw the image. if you want the movie starts in the center of the screen, use myMoviex/2 and myMoviey/2.
// to star in the right corner: only myMoviex and myMoviex. To start in the left, myMoviex/4 and myMoviexy/4.
image(myMovie2, myMovie2x, myMovie2y);
//update the location of the thing on the screen.
if(!(avX==0&&avY==0)&¢ers.length>1){
myMovie2destx = avX;
myMovie2desty = avY;
}
myMovie2x += (myMovie2destx-myMovie2x)/1f;
myMovie2y += (myMovie2desty-myMovie2y)/1.f;
}
}