blank camera view
in
Contributed Library Questions
•
1 year ago
Hi,
I post this cause it is another problem I have for Augmented Reality script I got : it shows no error but he camera view is blank when I run.
does anyone have any idea why it's blank.
Thanks.
-poserpro
I post this cause it is another problem I have for Augmented Reality script I got : it shows no error but he camera view is blank when I run.
- /**
- example from nyar4psg modified to demonstrate NyARMultiBoard + NyARMultiBoardMarker by Charl P. Botha <http://cpbotha.net/>
- */
- import codeanticode.gsvideo.*;
- import jp.nyatla.nyar4psg.*;
- import processing.opengl.*;
- GSCapture cam;
- NyARMultiBoard nya;
- PFont font, font2d;
- void setup() {
- size(640,480,P3D);
- colorMode(RGB, 100);
- font=createFont("FFScala", 32);
- font2d = createFont("FFScala", 10);
- cam=new GSCapture(this,width,height);
- String[] patts = {"patt.hiro", "patt.kanji"};
- double[] widths = {80,80};
- nya=new NyARMultiBoard(this,width,height,"camera_para.dat",patts,widths);
- print(nya.VERSION);
- nya.gsThreshold=120;
- nya.cfThreshold=0.4;
- }
- void drawMarkerPos(int[][] pos2d)
- {
- textFont(font,10.0);
- stroke(100,0,0);
- fill(100,0,0);
- for(int i=0;i<4;i++){
- ellipse(pos2d[i][0], pos2d[i][1],5,5);
- }
- fill(0,0,0);
- for(int i=0;i<4;i++){
- text("("+pos2d[i][0]+","+pos2d[i][1]+")",pos2d[i][0],pos2d[i][1]);
- }
- }
- void draw() {
- if (cam.available() !=true) {
- return;
- }
- cam.read();
- hint(DISABLE_DEPTH_TEST);
- image(cam,0,0);
- hint(ENABLE_DEPTH_TEST);
- if (nya.detect(cam))
- {
- hint(DISABLE_DEPTH_TEST);
- for (int i=0; i < nya.markers.length; i++)
- {
- if (nya.markers[i].detected)
- {
- drawMarkerPos(nya.markers[i].pos2d);
- }
- }
- hint(ENABLE_DEPTH_TEST);
- for (int i=0; i < nya.markers.length; i++)
- {
- if (nya.markers[i].detected)
- {
- nya.markers[i].beginTransform();
- translate(0,0,20);
- if (i == 0)
- {
- stroke(255,200,0);
- box(40);
- }
- else
- {
- stroke(0,200,255);
- sphere(25);
- }
- nya.markers[i].endTransform();
- }
- }
- }
- hint(DISABLE_DEPTH_TEST);
- textFont(font2d,10.0);
- textMode(SCREEN);
- fill(100,100,0);
- text("frame rate = " + frameRate, 10, 10);
- textMode(MODEL);
- hint(ENABLE_DEPTH_TEST);
- }
does anyone have any idea why it's blank.
Thanks.
-poserpro
1