jp.nyatla.nyar4psg
クラス SingleMarkerBaseClass

java.lang.Object
  上位を拡張 jp.nyatla.nyar4psg.NyARPsgBaseClass
      上位を拡張 jp.nyatla.nyar4psg.SingleMarkerBaseClass
直系の既知のサブクラス:
NyARBoard, SingleARTKMarker, SingleNyIdMarker

 class SingleMarkerBaseClass
extends NyARPsgBaseClass

単一マーカ認識ユースケースのベースクラス。同時に一つの座標変換行列を提供します。 座標変換行列の管理関数とプロパティ機能を提供します。


フィールドの概要
protected  NyARParam _ar_param
          ARToolkitパラメータのインスタンスです。
protected  NyAR4PsgConfig _config
           
protected  NyARFrustum _frustum
           
protected  PMatrix3D _ps_projection
           
protected  PImageRaster _src_raster
          入力画像ラスタです。
 PVector angle
          推奨されていません。 この変数は互換性の為に残されています。getMarkerMatrix()で得られる値から計算してください。
 int[][] pos2d
          推奨されていません。 この変数は互換性の為に残されています。getMarkerVertex2D()の値を使用してください。
 double[] projection
          推奨されていません。 この変数は互換性の為に残されています。getProjectionMatrix()で得られる値を使用してください。
 PVector trans
          推奨されていません。 この変数は互換性の為に残されています。getMarkerMatrix()で得られる値から計算してください。
 double[] transmat
          推奨されていません。 この変数は互換性の為に残されています。getMarkerMatrix()で得られる値を使用してください。
 
クラス jp.nyatla.nyar4psg.NyARPsgBaseClass から継承されたフィールド
_ps_background_mv, _ref_papplet, FRUSTUM_DEFAULT_FAR_CLIP, FRUSTUM_DEFAULT_NEAR_CLIP, VERSION
 
コンストラクタの概要
protected SingleMarkerBaseClass()
           
 
メソッドの概要
 void beginTransform()
          この関数は、ProcessingのModelviewとProjectionをマーカ平面にセットします。
 void beginTransform(PGraphics3D i_pgl)
          推奨されていません。  
 void endTransform()
          beginTransform(processing.core.PGraphics3D)でセットしたProjectionとModelViewを元に戻します。
 PMatrix3D getMarkerMatrix()
          この関数は、マーカの座標変換行列を返します。
 PVector[] getMarkerVertex2D()
          この関数は、マーカのスクリーン上の4頂点を返します。
 PMatrix3D getProjectionMatrix()
          [readonly]この関数は、Processing形式のProjectionMatrixの参照値を返します。
 PMatrix3D getProjectionMatrix(PMatrix3D iBuf)
          この関数は、ProjectionMatrixをi_bufへ複製して返します。
protected  void initInstance(PApplet parent, String i_cparam_file, int i_width, int i_height, NyAR4PsgConfig i_config)
           
 PImage pickupMarkerImage(int i_x1, int i_y1, int i_x2, int i_y2, int i_x3, int i_y3, int i_x4, int i_y4, int i_out_w_pix, int i_out_h_pix)
          この関数は、マーカの画像のXY平面上の4頂点でかこまれた領域から、画像を取得します。
protected  PImage pickupMarkerImage(NyARDoubleMatrix44 i_mat, int i_x1, int i_y1, int i_x2, int i_y2, int i_x3, int i_y3, int i_x4, int i_y4, int i_out_w_pix, int i_out_h_pix)
          PImageをラップしたラスタから画像を得ます。
 PImage pickupRectMarkerImage(int i_l, int i_t, int i_w, int i_h, int i_out_w_pix, int i_out_h_pix)
          この関数は、マーカのXY平面上の矩形領域から、画像を取得します。
 PVector screen2MarkerCoordSystem(int i_x, int i_y)
          この関数は、スクリーン座標を、idで指定したマーカ平面座標へ変換して返します。
 void setARClipping(float i_near, float i_far)
          この関数は、視錐台のクリップ面を設定します。
protected  void updateTransmat(NyARSquare i_square, NyARDoubleMatrix44 i_src)
           
 
クラス jp.nyatla.nyar4psg.NyARPsgBaseClass から継承されたメソッド
drawBackground, initInstance, matResult2GLArray, matResult2PMatrix3D, nyarMat2PsMat, PMatrix2GLProjection, PMatrix2GLProjection, setARPerspective, setBackgroundOrtho, setPerspective
 
クラス java.lang.Object から継承されたメソッド
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

フィールドの詳細

_ps_projection

protected final PMatrix3D _ps_projection

_ar_param

protected NyARParam _ar_param
ARToolkitパラメータのインスタンスです。


_frustum

protected final NyARFrustum _frustum

_config

protected NyAR4PsgConfig _config

_src_raster

protected PImageRaster _src_raster
入力画像ラスタです。PImageをラップします。継承クラスで入力画像をセットします。


angle

public final PVector angle
推奨されていません。 この変数は互換性の為に残されています。getMarkerMatrix()で得られる値から計算してください。
[read only]マーカのx,y,zの傾き角度です。 この角度は、ARToolKit座標系での値です。


trans

public final PVector trans
推奨されていません。 この変数は互換性の為に残されています。getMarkerMatrix()で得られる値から計算してください。
[read only]マーカのx,y,zの平行移動量です。 この角度は、ARToolKit座標系での値になります。


pos2d

public final int[][] pos2d
推奨されていません。 この変数は互換性の為に残されています。getMarkerVertex2D()の値を使用してください。
[read only]検出したマーカの4隅の2次元画像上の位置です。


transmat

public final double[] transmat
推奨されていません。 この変数は互換性の為に残されています。getMarkerMatrix()で得られる値を使用してください。
[read only]検出したマーカの変換行列です。 この角度は、ARToolKit座標系での値になります。


projection

public final double[] projection
推奨されていません。 この変数は互換性の為に残されています。getProjectionMatrix()で得られる値を使用してください。
[read only] OpenGLスタイルのProjectionMatrixです。

コンストラクタの詳細

SingleMarkerBaseClass

protected SingleMarkerBaseClass()
メソッドの詳細

getProjectionMatrix

public PMatrix3D getProjectionMatrix()
クラス NyARPsgBaseClass の記述:
[readonly]この関数は、Processing形式のProjectionMatrixの参照値を返します。

定義:
クラス NyARPsgBaseClass 内の getProjectionMatrix
戻り値:

getProjectionMatrix

public PMatrix3D getProjectionMatrix(PMatrix3D iBuf)
クラス NyARPsgBaseClass の記述:
この関数は、ProjectionMatrixをi_bufへ複製して返します。

定義:
クラス NyARPsgBaseClass 内の getProjectionMatrix
戻り値:
ProjectionMatrixです。

setARClipping

public void setARClipping(float i_near,
                          float i_far)
クラス NyARPsgBaseClass の記述:
この関数は、視錐台のクリップ面を設定します。この値のデフォルト値は、NyARPsgBaseClass.FRUSTUM_DEFAULT_NEAR_CLIPNyARPsgBaseClass.FRUSTUM_DEFAULT_FAR_CLIPです。 設定値は、次回のNyARPsgBaseClass.setARPerspective()から影響を及ぼします。現在の設定値にただちに影響を及ぼすものではありません。

オーバーライド:
クラス NyARPsgBaseClass 内の setARClipping
パラメータ:
i_near - NearPlaneの値を設定します。単位は[mm]です。
i_far - FarPlaneの値を設定します。単位は[mm]です。

getMarkerMatrix

public PMatrix3D getMarkerMatrix()
この関数は、マーカの座標変換行列を返します。 返却する行列はProcessing座標系です。

戻り値:

getMarkerVertex2D

public PVector[] getMarkerVertex2D()
この関数は、マーカのスクリーン上の4頂点を返します。

戻り値:

beginTransform

public void beginTransform(PGraphics3D i_pgl)
推奨されていません。 

この関数は互換性の為に残されています。 beginTransform()を使ってください。

パラメータ:
i_pgl - 通常は、PApplet.gをキャストして指定します。

beginTransform

public void beginTransform()
この関数は、ProcessingのModelviewとProjectionをマーカ平面にセットします。 この関数は、必ずendTransform()とペアで使います。 関数を実行すると、現在のModelView行列とProjection行列がインスタンスに保存され、新しい行列がセットされます。 これらを復帰するには、endTransform()を使います。
この関数は、次のコードと等価です。

:
PMatrix3D prev_mat=new PMatrix3D(((PGraphics3D)g).projection); setARPerspective();//prev_matは現在の行列退避用。
pushMatrix();
setMatrix(ar.getMarkerMatrix());
:


endTransform

public void endTransform()
beginTransform(processing.core.PGraphics3D)でセットしたProjectionとModelViewを元に戻します。 この関数は、必ずbeginTransform(processing.core.PGraphics3D)とペアで使います。
この関数は、次のコードと等価です。

:
setPerspective(prev_mat);//prev_matはsetARPerspectiveで退避した行列。
popMatrix();
setMatrix(ar.getMarkerMatrix());
:


screen2MarkerCoordSystem

public PVector screen2MarkerCoordSystem(int i_x,
                                        int i_y)
この関数は、スクリーン座標を、idで指定したマーカ平面座標へ変換して返します。

パラメータ:
i_x - スクリーン座標を指定します。
i_y - スクリーン座標を指定します。
戻り値:
マーカ平面上の座標点です。

pickupMarkerImage

public PImage pickupMarkerImage(int i_x1,
                                int i_y1,
                                int i_x2,
                                int i_y2,
                                int i_x3,
                                int i_y3,
                                int i_x4,
                                int i_y4,
                                int i_out_w_pix,
                                int i_out_h_pix)
この関数は、マーカの画像のXY平面上の4頂点でかこまれた領域から、画像を取得します。 取得元画像には、最後に#detect関数に入力した画像を使います。 座標点は、[mm]単位です。出力解像度はo_outの解像度に伸縮します。 座標点の指定順序は、右手系#CS_RIGHT_HANDなら右上から時計回りです。 座標点の指定順序は、左手系#CS_LEFT_HANDなら左上から時計回りです。

パラメータ:
i_x1 - 頂点座標1です。
i_y1 - 頂点座標1です。
i_x2 - 頂点座標2です。
i_y2 - 頂点座標2です。
i_x3 - 頂点座標3です。
i_y3 - 頂点座標3です。
i_x4 - 頂点座標4です。
i_y4 - 頂点座標4です。
i_out_w_pix - 出力画像のピクセル幅です。
i_out_h_pix - 出力画像のピクセル高さです。
戻り値:
取得したパターンを返します。

pickupRectMarkerImage

public PImage pickupRectMarkerImage(int i_l,
                                    int i_t,
                                    int i_w,
                                    int i_h,
                                    int i_out_w_pix,
                                    int i_out_h_pix)
この関数は、マーカのXY平面上の矩形領域から、画像を取得します。 座標点は、[mm]単位です。出力は、o_outの解像度に伸縮します。

パラメータ:
i_l - 左上の点を指定します。
i_t - 左上の点を指定します。
i_w - 矩形の幅を指定します。
i_h - 矩形の高さを指定します。
i_out_w_pix - 出力画像のピクセル幅です。
i_out_h_pix - 出力画像のピクセル高さです。
戻り値:
取得したパターンを返します。

updateTransmat

protected void updateTransmat(NyARSquare i_square,
                              NyARDoubleMatrix44 i_src)

initInstance

protected void initInstance(PApplet parent,
                            String i_cparam_file,
                            int i_width,
                            int i_height,
                            NyAR4PsgConfig i_config)
                     throws NyARException
例外:
NyARException

pickupMarkerImage

protected PImage pickupMarkerImage(NyARDoubleMatrix44 i_mat,
                                   int i_x1,
                                   int i_y1,
                                   int i_x2,
                                   int i_y2,
                                   int i_x3,
                                   int i_y3,
                                   int i_x4,
                                   int i_y4,
                                   int i_out_w_pix,
                                   int i_out_h_pix)
PImageをラップしたラスタから画像を得ます。

パラメータ:
i_mat -
i_x1 -
i_y1 -
i_x2 -
i_y2 -
i_x3 -
i_y3 -
i_x4 -
i_y4 -
i_out_w_pix -
i_out_h_pix -
戻り値:


NyAR4psgは、NyARToolkit projectで開発している、NyARToolKitのProcessingフロントエンドです。ソースコードは、sorceforge.jpNyARToolkitからダウンロードできます。
Copyright 2011 NyARToolkit project. All rights reserved.