NyARToolkit for Processing 3.0.2

[Japanese] [Spanish(Emiliusvgs)]

NyARToolkit for Processing 3.0.2 is released.

n5psg3

New library can handle Neture Feature Tracking easily.

https://github.com/nyatla/NyARToolkit-for-Processing

NFT Sample Sketch

NFT sketch is very simple.

// examples/Simplenft.pde
import processing.video.*;
import jp.nyatla.nyar4psg.*;

Capture cam;
MultiNft nya;

void setup() {
  size(640,480,P3D);
  colorMode(RGB, 100);
  println(MultiMarker.VERSION);
  cam=new Capture(this,640,480);
  nya=new MultiNft(this,width,height,"camera_para5.dat",NyAR4PsgConfig.CONFIG_PSG);
  nya.addNftTarget("infinitycat",160);//id=0
  cam.start();
}

void draw()
{
  if (cam.available() !=true) {
      return;
  }
  cam.read();
  nya.detect(cam);
  background(0);
  nya.drawBackground(cam);//frustumを考慮した背景描画
    if(!nya.isExist(0)){
      return;
    }
    nya.beginTransform(0);
    fill(255,0,0);
    translate(-80,55,20);
    box(40);
    nya.endTransform(); 
}

The program sequence are same as marker sketch.
The only difference is that are using the MultiNft instead of MultiMarker.

How to change NFT target

In order to make the NFT target fileset to use the nftFilesGen sketch.
Sketch will launch the file generator.

 

NyARToolkit for Processing 3.0.2リリース

[English][Spanish(Emiliusvgs)]

NyARToolkitのProcessing版を更新しました。

n5psg3
Processingからも自然特徴点とラッキングを利用することができます。

Processing 2.2.1/3.0.2で利用できます。

https://github.com/nyatla/NyARToolkit-for-Processing

NFTのサンプルスケッチ

NFTのスケッチは以下のように書くことができます。

import processing.video.*;
import jp.nyatla.nyar4psg.*;

Capture cam;
MultiNft nya;

void setup() {
  size(640,480,P3D);
  colorMode(RGB, 100);
  println(MultiMarker.VERSION);
  cam=new Capture(this,640,480);
  nya=new MultiNft(this,width,height,"camera_para5.dat",NyAR4PsgConfig.CONFIG_PSG);
  nya.addNftTarget("infinitycat",160);//id=0
  cam.start();
}

void draw()
{
  if (cam.available() !=true) {
      return;
  }
  cam.read();
  nya.detect(cam);
  background(0);
  nya.drawBackground(cam);//frustumを考慮した背景描画
    if(!nya.isExist(0)){
      return;
    }
    nya.beginTransform(0);
    fill(255,0,0);
    translate(-80,55,20);
    box(40);
    nya.endTransform(); 
}

プログラムの構造は従来のマーカを使ったスケッチと同一です。唯一違うのは、MultiMarkerの代わりにMultiNftを使っている点です。

NFTターゲットファイルの差し替え

NFTターゲットのファイルセットは、nftFilesGenスケッチを使って作ることができます。

FSET parametorを調整して、青と赤のキーポイントが満遍なく検出されるようにしてください。

 

NyARToolkit for Java 5.0.0リリース

English

NyARToolkit 5.0.0をリリースします。
https://github.com/nyatla/NyARToolkit

NyARToolkit 5.0.0では、ARToolKit5に搭載されている自然特徴点トラッキング(NFT)の機能が利用できるようになりました。

NyARToolKit5の開発には、DAQRI LLCから開発資金、及び技術提供をいただいています。DAQRI LLCと、ARToolKit開発チームに感謝いたします。

NFTトラッキングの起動方法

手っ取り早くNFTを体験する方法です。

  1. GitHubからNyARToolKitをチェックアウトしてください。
  2. EclipseにNyARToolkitのソースツリーをImportします。で示したプロジェクトにエラーが出ないことを確認します。
    p1
  3. NFTのターゲットとなる画像を印刷します。印刷できない方は画像を画面に表示してください。
    infinitycat.pdf
  4. コンピュータにカメラを接続してください。
  5. NyARToolkit.sample.joglパッケージのNftSimpleLite.javaを実行してください。
    p2
  6. 起動には数秒間かかります。撮影画像が現れた後にカメラで画像を撮影すると、カラーキューブが現れます。
    Ce7VUtqUIAAvu0o

NFTプログラミング

NyARToollitのNFTプログラミングはシンプルです。
数十行の実装でアプリケーションを実装できます。

NftSimpleLite.javaがNFTアプリケーションの雛形です。このコードを改変することで、直ぐにオリジナルのアプリケーションを実装できます。

public class NftSimpleLite extends GlSketch
{
  String nftdataset="d:\\infinitycat";
  String cparam="../../Data/testcase/camera_para5.dat";
  private Webcam camera;
  private NyARGlNftSystem nyar;
  private NyARGlRender render;
  private NyARSensor sensor;
  public void setup(GL gl)throws Exception
  {
    this.size(640,480);
    NyARNftSystemConfig config = new NyARNftSystemConfig(new FileInputStream(cparam),640,480);
    this.camera=Webcam.getDefault();
    this.camera.setViewSize(new Dimension(640,480));
    this.nyar=new NyARGlNftSystem(config);   //create MarkerSystem
    this.render=new NyARGlRender(this.nyar);
    this.sensor=new NyARSensor(config.getScreenSize());
    //
    this.id=this.nyar.addNftTarget(nftdataset,160);
    gl.glEnable(GL.GL_DEPTH_TEST);
    this.camera.open();
  }
  private int id;
  public void draw(GL gl)throws Exception
  {
    synchronized(this.camera){
      try {
        this.sensor.update(new NyARBufferedImageRaster(this.camera.getImage()));        
        this.render.drawBackground(gl,this.sensor.getSourceImage());
        this.render.loadARProjectionMatrix(gl);
        this.nyar.update(this.sensor);
        if(this.nyar.isExistTarget(this.id)){
          this.nyar.loadTransformMatrix(gl,this.id);
          this.render.colorCube(gl,40,80,60,20);
        }
        Thread.sleep(1);
      } catch (Exception e) {
        e.printStackTrace();
      }
    }
  }  
  public static void main(String[] args)
  {
    new NftSimpleLite().run();
    return;
  }
}
  • トラッキングする画像を変えるには?
    →nftdatasetのファイルパス名を変えます。NFTではiset ,fset, fset3の3種のファイルが同じ場所に置かれている必要があります。
    たとえば”d:\\example”を指定すると、c:\\example.iset, c:\\example.fset, c:\\example.fset3のファイルセットがトラッキング画像として使われます。
  • トラッキング画像のサイズを変えるには?
    →addNftTarget関数の第二引数に、印刷した画像の横幅をmm単位で指定してください。
  • トラッキング画像を作るには?
    →NyARToolkit.utility.zipの中にあるNftFileGenerator.jarで画像ファイルからトラッキング画像を作ることができます。
    https://github.com/nyatla/NyARToolkit/releasesからダウンロードしてください。

ARToolKit5との互換性について

NyARToolKitは、ARToolKit5のアルゴリズムを忠実に移植したものです。計算結果はARToolKitのそれとほぼ同一ですが、若干の差があります。

差の原因は、浮動小数点計算の精度差、一部の算術関数を展開したことによるものです。

NFTのターゲッ トファイル(iset,fset,fset3)やカメラパラメータファイルについては、ARToolKitと互換性があります。相互に使うことができます。

NyARToolkit for Java 5.0.0

NyARToolkit for Java 5.0.0 has been released.
https://github.com/nyatla/NyARToolkit

NyARToolkit 5.0.0 supports the natural features tracking which is same as implemented on ARToolKit5 (NFT) .

The development of NyARToolKit5 has received the funding and technical assistance by DAQRI LLC.
I’m grateful to DAQRI LLC and ARToolKit team.

How to running NFT sample

  1. Checkout NyARToolKit from Github.
  2. Import NyARToolkit projects to Eclipse. Make sure that there are no errors in the project shown in .
    p1
  3. Print NFT image  to paper. If you do not have a printer, display the pdf file into the screen.
    infinitycat.pdf
  4. Connect your webcam to computer.
  5. Run NftSimpleLite.java in NyARToolkit.sample.jogl package.
    p2
  6. It takes a few seconds to startup. When you take a picture with the camera, The color cube will display on image.
    Ce7VUtqUIAAvu0o

NFT Programming

NFT programming with NyARToolkit is simply.
It requires only a few dozen lines of code.

NftSimpleLite.java is a template of NFT application. You can create the unique application by modify the template.

public class NftSimpleLite extends GlSketch
{
  String nftdataset="d:\\infinitycat";
  String cparam="../../Data/testcase/camera_para5.dat";
  private Webcam camera;
  private NyARGlNftSystem nyar;
  private NyARGlRender render;
  private NyARSensor sensor;
  public void setup(GL gl)throws Exception
  {
    this.size(640,480);
    NyARNftSystemConfig config = new NyARNftSystemConfig(new FileInputStream(cparam),640,480);
    this.camera=Webcam.getDefault();
    this.camera.setViewSize(new Dimension(640,480));
    this.nyar=new NyARGlNftSystem(config);   //create MarkerSystem
    this.render=new NyARGlRender(this.nyar);
    this.sensor=new NyARSensor(config.getScreenSize());
    //
    this.id=this.nyar.addNftTarget(nftdataset,160);
    gl.glEnable(GL.GL_DEPTH_TEST);
    this.camera.open();
  }
  private int id;
  public void draw(GL gl)throws Exception
  {
    synchronized(this.camera){
      try {
        this.sensor.update(new NyARBufferedImageRaster(this.camera.getImage()));        
        this.render.drawBackground(gl,this.sensor.getSourceImage());
        this.render.loadARProjectionMatrix(gl);
        this.nyar.update(this.sensor);
        if(this.nyar.isExistTarget(this.id)){
          this.nyar.loadTransformMatrix(gl,this.id);
          this.render.colorCube(gl,40,80,60,20);
        }
        Thread.sleep(1);
      } catch (Exception e) {
        e.printStackTrace();
      }
    }
  }  
  public static void main(String[] args)
  {
    new NftSimpleLite().run();
    return;
  }
}
  • How to change the tracking image file?
    →Change nftdataset value. In NFT, it need to place 3 files(.iset, .fset, .fset3) onto same path.
    For example: If you specify “d \\ example”, “c:\\ example.iset”, “c:\\ example.fset”, “c:\\example.fset3” will be used as a tracking image.
  • How to change the tracking image size?
    →Set the paper image width in mm to the second parameter of addNftTarget function.
  • How to make the tracking image set file?
    →NftFileGenerator.jar is a fileset generator.
    Download NyARToolkit.utility.zip from the following URL.
    https://github.com/nyatla/NyARToolkit/releases

For compatibility with ARToolKit5

Calculation algorithm of NyARToolKit is identical to the ARToolKit5 but there is a slight difference.
The cause of the difference are the accuracy of floating-point calculations, and the simplification of  the math functions.

The NyARToolKit and ARToolKit data files(iset fset fset3) are compatible.
These files can be used with each other.