some body help me i wanna excute this code

import jp.nyatla.nyar4psg.*;
import codeanticode.gsvideo.*;

String camPara ="";
String patternPath = "";
int arWidth = 640 ;
int arHeight = 480;

int num Markers = 10;
GSCapture cam ;
MultiMarker nya;

float displayScale ;
float[] colors = new color [numMarkers];
float[] scaler = new float[numMarkers];

void setup(){
size(640,480,P3D);
cam = nrwGSCapture(this, 640, 480);
cam.start();
noStroke();

displayScale = (float) width /arWidth;
nya = new MultiMarker(this, arWidth, arHeight, camPara, NyARAPsagConfig.CONFIG_DEFAULT);
nya.setLostDeplay(1);
String[] patterns = loadPatternFilenames(patternPath);


for (int i=0; i< numMarkers ;i++)
nyaARMarker(patternPath + "/" + pattern[i], 80);
colors[i] = color(random(255), random(255),random(255), 160);
scaler[i] = random(0.5,1.9);


}

void draw (){

   if (cam.avaible){
   cam.read();
   background(0);
   image(cam, 0, 0, width, height );
   PImage cSmall = cam.get();
   cSmall[].resize(arWidth, arHeight);
   nya.detect(cSmall);
   drawMarkers();
  // drawBoxes();
 }
}

void drawMarker(){
  
  textAlign(LEFT, TOP);
  textSize(10);
  noStroke();
  scale(displayScale);
  
  for(int i = 0 ; i < numMarkers ; i++){
  if((!nya.isExistMarker(i))){continue;}
  PVector[] pos2d = nya.getMarkerVertex2D(i);
  for(int j= 0 ; j <=3 ; j++){
  String s = "(" + int(pos2d[j].x) + "," + int(pos2d[j]).x) + ")";
  fill(255);
  rect(pos2d[j].x, pos2d[j]).y, textWidth(s)+3, textAscent() + textDescent() +3);
  fill(0);
  text(s, pos2d[j].x + 2, pos2d[].y + 2);
  fill(255, 0 , 0);
  ellipse(pos2d[j].x, pos2d[j].y, 5, 5);
  
  }
  }
  
}

String[] loadPatternFilenames(String path){
File folder = new File(path);
FilenameFilter pattFiler = new FilenameFilter(){
public boolean accept(File dir, String name){
 return name.tolowercase().endsWith(".path");
 
}
}
return folder.list(patternFilter);
}</pre>

Answers

  • What's your question?

    When posting code, make sure you use the code button to preserve formatting.

  • sory i am new here what is the code button !

  • well , i just have error i wanna fix it ..

    Capture

  • Answer ✓

    Looks unrelated to Android, will move it.

    If I copy & paste your code in Processing 3.0a5, I get a bunch of errors, the missing semi-colon being only one of them.

    • int num Markers = 10;
      This line make no sense. Since you use a numMarkers later, I suppose you inserted accidentally a space.
    • cSmall[].resize(arWidth, arHeight);
      What are these [] doing here? Try and remove them.
    • String s = "(" + int(pos2d[j].x) + "," + int(pos2d[j]).x) + ")";
      One extra closing parenthesis. You probably want int(pos2d[j].x)
    • rect(pos2d[j].x, pos2d[j]).y, textWidth(s)+3, textAscent() + textDescent() +3);
      Another extra ), remove it before .y
    • text(s, pos2d[j].x + 2, pos2d[].y + 2);
      Nothing between the brackets here. Try text(s, pos2d[j].x + 2, pos2d[j].y + 2);
    • As said in the error you report, you should add a semi-colon ; at the end of the line 82.
  • at the line line 24 he does not accept this .. NyARAPsagConfig.CONFIG_DEFAULT

Sign In or Register to comment.