Production Level Knowledge & Tips

  1. 未分類
  2. 13 view

[AR]Try to use NyARToolkit

Background

There is the library for developing maker base AR program.
It’s called ARToolKit.
It’s processing version is NyARToolkit.

Implementation

Download library is from
here.
And copy it to processing’s home directory’s libraries directory.
Then, change the library’s directory name is “nyar4psg”. Program is following.
import jp.nyatla.nyar4psg.*;
import processing.video.*;

// Definition camera device interface
Capture cam;
MultiMarker ar;
// Marker ID
int id;

void setup() {
  // Set size
  size(640,480,P3D);
  // Create camera device interface
  cam = new Capture(this, width, height);
  ar = new MultiMarker(this, width, height, "camera_para.dat", NyAR4PsgConfig.CONFIG_PSG);
  // Register marker
  id = ar.addARMarker("patt.hiro", 60);
}

void draw() {
   // Check whether camera is available
  if (cam.available() == false) return;
  // Get camera image
  cam.read();
  // Draw camera image
  background(0);
  ar.drawBackground(cam);
  // Detect marker
  ar.detect(cam);
  if (ar.isExistMarker(id)) {
    // Draw box
    ar.beginTransform(id);
    fill(116,163,241,100);
    translate(0,0,15);
    box(30);
    ar.endTransform();
  }
}
After save the program, copy nyar4ps/data to the directory.

Result

SimpleAR
We can get the following result when we pass printed the marker over a camera.

未分類 recent post

  1. Install sbt 1.0.0 and run sample template

  2. Visualization of Neural Network and its Train…

  3. [Machine Learning]Created docker image includ…

  4. [Node.js]How to write batch script with Node.…

  5. [Hive]Get top n items for each category

関連記事

PAGE TOP