AR Codes in Processing 2??
in
Contributed Library Questions
•
10 months ago
Hi, I have created a code using
http://nyatla.jp/nyartoolkit/wp/ Libraries to create an AR Code that plays a flat video. Here is the code.
import processing.video.*;
import jp.nyatla.nyar4psg.*;
Movie myMovie;
Capture cam;
MultiMarker nya;
void setup() {
size(1280,720,P3D);
colorMode(RGB, 100);
println(MultiMarker.VERSION);
cam=new Capture(this,1280,720);
nya=new MultiMarker(this,width,height,"camera_para.dat",NyAR4PsgConfig.CONFIG_PSG);
nya.addARMarker("4x4_01.patt",80);//id=0
nya.addARMarker("4x4_01.patt",80);//id=1
myMovie = new Movie(this, "fullrender.mp4");
myMovie.loop();
myMovie.play();
}
void draw()
{
if (cam.available() !=true) {
return;
}
cam.read();
nya.detect(cam);
background(0);
nya.drawBackground(cam); //frustumを考慮した背景描画
for(int i=0;i<2;i++){
if((!nya.isExistMarker(i))){
continue;
}
nya.beginTransform(i);
scale(0.1,0.1,1);
rotateZ(PI/2);
translate(0,0,20);
image(myMovie, -640, -360);
nya.endTransform();
}
}
It works perfectly in Processing 1.5, but I can't get it to play in processing 2.0. It appears that the video plays, as I can hear the sound, but my camera won't. Any help on sorting this out ??
import processing.video.*;
import jp.nyatla.nyar4psg.*;
Movie myMovie;
Capture cam;
MultiMarker nya;
void setup() {
size(1280,720,P3D);
colorMode(RGB, 100);
println(MultiMarker.VERSION);
cam=new Capture(this,1280,720);
nya=new MultiMarker(this,width,height,"camera_para.dat",NyAR4PsgConfig.CONFIG_PSG);
nya.addARMarker("4x4_01.patt",80);//id=0
nya.addARMarker("4x4_01.patt",80);//id=1
myMovie = new Movie(this, "fullrender.mp4");
myMovie.loop();
myMovie.play();
}
void draw()
{
if (cam.available() !=true) {
return;
}
cam.read();
nya.detect(cam);
background(0);
nya.drawBackground(cam); //frustumを考慮した背景描画
for(int i=0;i<2;i++){
if((!nya.isExistMarker(i))){
continue;
}
nya.beginTransform(i);
scale(0.1,0.1,1);
rotateZ(PI/2);
translate(0,0,20);
image(myMovie, -640, -360);
nya.endTransform();
}
}
It works perfectly in Processing 1.5, but I can't get it to play in processing 2.0. It appears that the video plays, as I can hear the sound, but my camera won't. Any help on sorting this out ??
1