jp.nyatla.nyar4psg
クラス NyARBoard

java.lang.Object
  上位を拡張 jp.nyatla.nyar4psg.NyARBoard

public class NyARBoard
extends java.lang.Object

This class calculate a ARToolKit base transformation matrix from PImage. This class handles one marker, and calculates the transformation matrix that displays the object above the marker.

 NyARBoard needs two an external configuration file "Marker file" and "Camera parameter" files.
 These are compatible with the original ARToolKit. 
 Place those files to under the data directory of the sketch. (see example.)
 

JP: このクラスは、PImageからARToolKit準拠の変換行列を求めるクラスです。 マーカを1枚の板に見立てて、そこを中心にした座標系を計算します。 同時検出可能なマーカは1種類、1個です。
 NyARBoardは、2つの外部設定ファイル"マーカファイル"と"カメラパラメータ"ファイルを必要とします。
 これらはARToolKitのものと互換性があります。
 これらはスケッチのdataディレクトリ以下に配置をして下さい。(exampleを見てください。)
 

作成者:
nyatla

フィールドの概要
 processing.core.PVector angle
          The angle value in radian unit of "x,y,z" .
 double cfThreshold
          The threshold value of marker pattern confidence.
 double confidence
          The confidence value of detected marker.
static int CS_LEFT
           
static int CS_RIGHT
           
 int gsThreshold
          The threshold value of labeling process from gray scale image.
 int lostCount
          It is a number in which it continuously lost the marker.
 int lostDelay
          NyARBoard ignores that it lost the marker while under specified number.
 int[][] pos2d
          The position of 4 corner of marker.
 double[] projection
          The projection matrix adday for OpenGL projection.
 processing.core.PVector trans
          The translation value in radian unit of "x,y,z".
 double[] transmat
          The transform matrix of detected marker.
 java.lang.String VERSION
          version information.
 
コンストラクタの概要
NyARBoard(processing.core.PApplet parent, int i_width, int i_htight, java.lang.String i_cparam, java.lang.String i_patt, int i_patt_width)
          This function is constructor same as i_projection_coord_system=CS_LEFT.
NyARBoard(processing.core.PApplet parent, int i_width, int i_htight, java.lang.String i_cparam, java.lang.String i_patt, int i_patt_width, int i_projection_coord_system)
          This function is constructor.
 
メソッドの概要
 void beginTransform(javax.media.opengl.GL i_gl)
           
 void beginTransform(processing.opengl.PGraphicsOpenGL i_pgl)
          This function sets corresponding transform matrix to the surface of the marker to OpenGL.
 boolean detect(processing.core.PImage i_image)
          This function detect a marker which is must higher confidence in i_image.
 void endTransform()
          This function recover coordinate system that was changed by beginTransform function.
 
クラス java.lang.Object から継承されたメソッド
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

フィールドの詳細

CS_RIGHT

public static final int CS_RIGHT
関連項目:
定数フィールド値

CS_LEFT

public static final int CS_LEFT
関連項目:
定数フィールド値

VERSION

public final java.lang.String VERSION
version information.
JP: バージョン文字列です。

関連項目:
定数フィールド値

lostDelay

public int lostDelay
NyARBoard ignores that it lost the marker while under specified number. Must be "n>=0".
JP: 消失遅延数。マーカ消失後、指定回数は過去の情報を維持します。 値は0以上であること。


lostCount

public int lostCount
It is a number in which it continuously lost the marker. This value range is "0<n<lostDelay"
JP: 連続でマーカを見失った回数。この値は0

cfThreshold

public double cfThreshold
The threshold value of marker pattern confidence. This value range is "0.0<n<1.0". When marker confidence is larger than this value, NyARBoard detects the marker.
JP: マーカの座標変換を行う閾値。0.0<n<1.0の値をとります。 この数値より一致度が大きい場合のみ、マーカを検出したと判定され、座標計算が行われます。


projection

public final double[] projection
The projection matrix adday for OpenGL projection. This value is initialized by constructor.
JP: OpenGLのProjection配列。コンストラクタで初期化されます。


angle

public final processing.core.PVector angle
The angle value in radian unit of "x,y,z" .
JP: マーカのx,y,zの傾き角度です。


trans

public final processing.core.PVector trans
The translation value in radian unit of "x,y,z".
JP: マーカのx,y,zの平行移動量です。


confidence

public double confidence
The confidence value of detected marker.
JP: 検出したマーカの一致度です。


pos2d

public final int[][] pos2d
The position of 4 corner of marker.
JP: 検出したマーカの4隅の2次元画像上の位置です。


transmat

public final double[] transmat
The transform matrix of detected marker.
JP: 検出したマーカの変換行列です。


gsThreshold

public int gsThreshold
The threshold value of labeling process from gray scale image. This value range is "0<=n<=255".
JP: マーカ検出時のグレースケール閾値を指定します。この値は、0<=n<=255をります。

コンストラクタの詳細

NyARBoard

public NyARBoard(processing.core.PApplet parent,
                 int i_width,
                 int i_htight,
                 java.lang.String i_cparam,
                 java.lang.String i_patt,
                 int i_patt_width,
                 int i_projection_coord_system)
This function is constructor.
JP: この関数はコンストラクタです。

パラメータ:
parent - Specify processing instance.
JP: processingのインスタンスを指定します。
i_width - Width of source image size for "detect()".
JP: detect()に渡す入力画像の幅を指定します。
i_htight - Height of source image size for "detect()".
JP: detectに渡す入力画像の高さを指定します。
i_cparam - The file name of the camera parameter of ARToolKit format. Place the file to "data" directory at sketch.
JP: ARToolKitのパラメータファイル名を指定します。パラメータファイルはdataディレクトリにおいて下さい。
i_patt - The file name of the marker pattern file of ARToolkit. Place the file to "data" directory at sketch. The marker resolution must be 16x16.
JP: マーカのパターンファイル名を指定します。パターンファイルは、dataディレクトリにおいて下さい。 マーカの解像度は、16x16である必要があります。
i_patt_width - The length of one side of a square marker in millimeter unit.
JP: マーカのサイズを指定します。単位はmmです。
i_projection_coord_system - Coordinate system flag of projection Matrix. Should be NyARBoard.CS_RIGHT or NyARBoard.Left(default)
JP: Projection Matrixの座標系を指定します。NyARBoard.CS_RIGHT か NyARBoard.Left(規定値)を指定します。

NyARBoard

public NyARBoard(processing.core.PApplet parent,
                 int i_width,
                 int i_htight,
                 java.lang.String i_cparam,
                 java.lang.String i_patt,
                 int i_patt_width)
This function is constructor same as i_projection_coord_system=CS_LEFT.
JP: この関数はi_projection_coord_systemにCS_LEFTを設定するコンストラクタです。

パラメータ:
parent - Specify processing instance.
JP: processingのインスタンスを指定します。
i_width - Width of source image size for "detect()".
JP: detect()に渡す入力画像の幅を指定します。
i_htight - Height of source image size for "detect()".
JP: detectに渡す入力画像の高さを指定します。
i_cparam - The file name of the camera parameter of ARToolKit format. Place the file to "data" directory at sketch.
JP: ARToolKitのパラメータファイル名を指定します。パラメータファイルはdataディレクトリにおいて下さい。
i_patt - The file name of the marker pattern file of ARToolkit. Place the file to "data" directory at sketch. The marker resolution must be 16x16.
JP: マーカのパターンファイル名を指定します。パターンファイルは、dataディレクトリにおいて下さい。 マーカの解像度は、16x16である必要があります。
i_patt_width - The length of one side of a square marker in millimeter unit.
JP: マーカのサイズを指定します。単位はmmです。
メソッドの詳細

detect

public boolean detect(processing.core.PImage i_image)
This function detect a marker which is must higher confidence in i_image. When function detects marker, properties (pos2d,angle,trans,confidence,transmat) are updated.
JP: i_imageから最も一致度の高いマーカを検出し、cfThreshold以上の一致度であれば、 pos2d,angle,trans,confidence,transmatのプロパティを更新します。

パラメータ:
i_image - Specify source image.
JP: 検出するイメージを設定します。
戻り値:
TRUE if marker found;otherwise FALSE.
JP: マーカが検出され、有効な値が得られればTRUEを返します。 TRUEであれば、プロパティが更新されています。

beginTransform

public void beginTransform(processing.opengl.PGraphicsOpenGL i_pgl)
This function sets corresponding transform matrix to the surface of the marker to OpenGL. The coordinate system of processing moves to the surface of the marker when this function is executed. Must return the coordinate system by using endTransform function at the end.
JP: 座標変換を実行したMatrixを準備します。 この関数を実行すると、processingの座標系がマーカ表面に設定されます。 描画終了後には、必ずendTransform関数を呼び出して座標系を戻してください。

パラメータ:
i_pgl - Specify PGraphicsOpenGL instance. Please cast and set a "g" member of processing.
JP: PGraphicsOpenGLインスタンスを設定します。processingのgメンバをキャストして設定してください。

beginTransform

public void beginTransform(javax.media.opengl.GL i_gl)

endTransform

public void endTransform()
This function recover coordinate system that was changed by beginTransform function.
JP: beginTransformによる座標変換を解除して元に戻します。