OSDN Git Service

[backup]NyARToolkit
[nyartoolkit-and/nyartoolkit-and.git] / trunk / src / jp / nyatla / nyartoolkit / detector / NyARDetectMarker.java
index fd477a0..f442893 100644 (file)
  *   HITLab, University of Washington, Seattle\r
  * http://www.hitl.washington.edu/artoolkit/\r
  *\r
- * The NyARToolkit is Java version ARToolkit class library.\r
- * Copyright (C)2008 R.Iizuka\r
+ * The NyARToolkit is Java edition ARToolKit class library.\r
+ * Copyright (C)2008-2009 Ryo Iizuka\r
  *\r
- * This program is free software; you can redistribute it and/or\r
- * modify it under the terms of the GNU General Public License\r
- * as published by the Free Software Foundation; either version 2\r
- * of the License, or (at your option) any later version.\r
+ * This program is free software: you can redistribute it and/or modify\r
+ * it under the terms of the GNU General Public License as published by\r
+ * the Free Software Foundation, either version 3 of the License, or\r
+ * (at your option) any later version.\r
  * \r
  * This program is distributed in the hope that it will be useful,\r
  * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
  * GNU General Public License for more details.\r
- * \r
+ *\r
  * You should have received a copy of the GNU General Public License\r
- * along with this framework; if not, write to the Free Software\r
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\r
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.\r
  * \r
  * For further information please contact.\r
  *     http://nyatla.jp/nyatoolkit/\r
- *     <airmail(at)ebony.plala.or.jp>\r
+ *     <airmail(at)ebony.plala.or.jp> or <nyatla(at)nyatla.jp>\r
  * \r
  */\r
 package jp.nyatla.nyartoolkit.detector;\r
 \r
 import jp.nyatla.nyartoolkit.NyARException;\r
 import jp.nyatla.nyartoolkit.core.*;\r
-import jp.nyatla.nyartoolkit.core.match.NyARMatchPatt_Color_WITHOUT_PCA;\r
+import jp.nyatla.nyartoolkit.core.match.*;\r
+import jp.nyatla.nyartoolkit.core.param.NyARParam;\r
+import jp.nyatla.nyartoolkit.core.pickup.*;\r
 import jp.nyatla.nyartoolkit.core.raster.*;\r
-\r
-\r
+import jp.nyatla.nyartoolkit.core.raster.rgb.*;\r
+import jp.nyatla.nyartoolkit.core.transmat.*;\r
+import jp.nyatla.nyartoolkit.core.rasterfilter.rgb2bin.*;\r
+import jp.nyatla.nyartoolkit.core.squaredetect.NyARCoord2Linear;\r
+import jp.nyatla.nyartoolkit.core.squaredetect.NyARSquareContourDetector;\r
+import jp.nyatla.nyartoolkit.core.squaredetect.NyARSquare;\r
+import jp.nyatla.nyartoolkit.core.squaredetect.NyARSquareContourDetector_Rle;\r
+import jp.nyatla.nyartoolkit.core.types.*;\r
+import jp.nyatla.nyartoolkit.core.types.stack.NyARObjectStack;\r
 \r
 class NyARDetectMarkerResult\r
 {\r
-    public int arcode_id;\r
-    public int direction;\r
-    public double confidence;\r
-    public NyARSquare ref_square;\r
+       public int arcode_id;\r
+       public double confidence;\r
+\r
+       public NyARSquare square=new NyARSquare();\r
 }\r
-class NyARDetectMarkerResultHolder\r
+\r
+\r
+class NyARDetectMarkerResultStack extends NyARObjectStack<NyARDetectMarkerResult>\r
 {\r
-    public NyARDetectMarkerResult[] result_array=new NyARDetectMarkerResult[1];\r
-    /**\r
-     * result_holderを最大i_reserve_size個の要素を格納できるように予約します。\r
-     * @param i_reserve_size\r
-     */\r
-    public void reservHolder(int i_reserve_size)\r
-    {\r
-       if(i_reserve_size>=result_array.length){\r
-           int new_size=i_reserve_size+5;\r
-           result_array=new NyARDetectMarkerResult[new_size];\r
-           for(int i=0;i<new_size;i++){\r
-               result_array[i]=new NyARDetectMarkerResult();\r
-           }\r
+       public NyARDetectMarkerResultStack(int i_length) throws NyARException\r
+       {\r
+               super(i_length,NyARDetectMarkerResult.class);\r
+               return;\r
        }\r
-    }\r
+       protected NyARDetectMarkerResult createElement()\r
+       {\r
+               return new NyARDetectMarkerResult();\r
+       }       \r
 }\r
+\r
+\r
 /**\r
- * 複数のマーカーを検出し、それぞれに最も一致するARコードを、コンストラクタで登録したARコードから\r
- * 探すクラスです。最大300個を認識しますが、ゴミラベルを認識したりするので100個程度が限界です。\r
- *\r
+ * 複数のマーカーを検出し、それぞれに最も一致するARコードを、コンストラクタで登録したARコードから 探すクラスです。最大300個を認識しますが、ゴミラベルを認識したりするので100個程度が限界です。\r
+ * \r
  */\r
-public class NyARDetectMarker{\r
-    private static final int AR_SQUARE_MAX=300;\r
-    private boolean is_continue=false;\r
-    private NyARMatchPatt_Color_WITHOUT_PCA match_patt;\r
-    private NyARDetectSquare square;\r
-    private final NyARSquareList square_list=new NyARSquareList(AR_SQUARE_MAX);\r
-    private NyARCode[] codes;\r
-    protected NyARTransMat transmat;\r
-    private double[] marker_width;\r
-    private int number_of_code;\r
-    //検出結果の保存用\r
-    private NyARColorPatt patt;\r
-    \r
-    private NyARDetectMarkerResultHolder result_holder=new NyARDetectMarkerResultHolder();\r
-    \r
-    /**\r
-     * 複数のマーカーを検出し、最も一致するARCodeをi_codeから検索するオブジェクトを作ります。\r
-     * @param i_param\r
-     * カメラパラメータを指定します。\r
-     * @param i_code\r
-     * 検出するマーカーのARCode配列を指定します。配列要素のインデックス番号が、そのままgetARCodeIndex関数で\r
-     * 得られるARCodeインデックスになります。\r
-     * 例えば、要素[1]のARCodeに一致したマーカーである場合は、getARCodeIndexは1を返します。\r
-     * 先頭からi_number_of_code個の要素には、有効な値を指定する必要があります。\r
-     * @param i_marker_width\r
-     * i_codeのマーカーサイズをミリメートルで指定した配列を指定します。\r
-     * 先頭からi_number_of_code個の要素には、有効な値を指定する必要があります。\r
-     * @param i_number_of_code\r
-     * i_codeに含まれる、ARCodeの数を指定します。\r
-     * @throws NyARException\r
-     */\r
-    public NyARDetectMarker(NyARParam i_param,NyARCode[] i_code,double[] i_marker_width,int i_number_of_code) throws NyARException\r
-    {\r
-       //解析オブジェクトを作る\r
-       this.square=new NyARDetectSquare(i_param);\r
-       this.transmat=new NyARTransMat_O2(i_param);\r
-       //比較コードを保存\r
-       this.codes=i_code;\r
-       //比較コードの解像度は全部同じかな?(違うとパターンを複数種つくらないといけないから)\r
-       int cw=i_code[0].getWidth();\r
-       int ch=i_code[0].getHeight();\r
-       for(int i=1;i<i_number_of_code;i++){\r
-           if(cw!=i_code[i].getWidth() || ch!=i_code[i].getHeight()){\r
-               //違う解像度のが混ざっている。\r
-               throw new NyARException();\r
-           }\r
-       }       \r
-       //評価パターンのホルダを作る\r
-       this.patt=new NyARColorPatt_O3(cw,ch);\r
-       this.number_of_code=i_number_of_code;\r
+public class NyARDetectMarker\r
+{\r
+       /**\r
+        * detectMarkerのコールバック関数\r
+        */\r
+       private class DetectSquareCB implements NyARSquareContourDetector.DetectMarkerCallback\r
+       {\r
+               //公開プロパティ\r
+               public NyARDetectMarkerResultStack result_stack=new NyARDetectMarkerResultStack(NyARDetectMarker.AR_SQUARE_MAX);\r
+               //参照インスタンス\r
+               public INyARRgbRaster _ref_raster;\r
+               //所有インスタンス\r
+               private INyARColorPatt _inst_patt;\r
+               private NyARMatchPattDeviationColorData _deviation_data;\r
+               private NyARMatchPatt_Color_WITHOUT_PCA[] _match_patt;\r
+               private final NyARMatchPattResult __detectMarkerLite_mr=new NyARMatchPattResult();\r
+               private NyARCoord2Linear _coordline;\r
+               \r
+               public DetectSquareCB(INyARColorPatt i_inst_patt,NyARCode[] i_ref_code,int i_num_of_code,NyARParam i_param) throws NyARException\r
+               {\r
+                       final int cw = i_ref_code[0].getWidth();\r
+                       final int ch = i_ref_code[0].getHeight();\r
+\r
+                       this._inst_patt=i_inst_patt;\r
+                       this._coordline=new NyARCoord2Linear(i_param.getScreenSize(),i_param.getDistortionFactor());\r
+                       this._deviation_data=new NyARMatchPattDeviationColorData(cw,ch);\r
+\r
+                       //NyARMatchPatt_Color_WITHOUT_PCA[]の作成\r
+                       this._match_patt=new NyARMatchPatt_Color_WITHOUT_PCA[i_num_of_code];\r
+                       this._match_patt[0]=new NyARMatchPatt_Color_WITHOUT_PCA(i_ref_code[0]);\r
+                       for (int i = 1; i < i_num_of_code; i++){\r
+                               //解像度チェック\r
+                               if (cw != i_ref_code[i].getWidth() || ch != i_ref_code[i].getHeight()) {\r
+                                       throw new NyARException();\r
+                               }\r
+                               this._match_patt[i]=new NyARMatchPatt_Color_WITHOUT_PCA(i_ref_code[i]);\r
+                       }\r
+                       return;\r
+               }\r
+               private NyARIntPoint2d[] __tmp_vertex=NyARIntPoint2d.createArray(4);\r
+               /**\r
+                * 矩形が見付かるたびに呼び出されます。\r
+                * 発見した矩形のパターンを検査して、方位を考慮した頂点データを確保します。\r
+                */\r
+               public void onSquareDetect(NyARSquareContourDetector i_sender,int[] i_coordx,int[] i_coordy,int i_coor_num,int[] i_vertex_index) throws NyARException\r
+               {\r
+                       NyARMatchPattResult mr=this.__detectMarkerLite_mr;\r
+                       //輪郭座標から頂点リストに変換\r
+                       NyARIntPoint2d[] vertex=this.__tmp_vertex;\r
+                       vertex[0].x=i_coordx[i_vertex_index[0]];\r
+                       vertex[0].y=i_coordy[i_vertex_index[0]];\r
+                       vertex[1].x=i_coordx[i_vertex_index[1]];\r
+                       vertex[1].y=i_coordy[i_vertex_index[1]];\r
+                       vertex[2].x=i_coordx[i_vertex_index[2]];\r
+                       vertex[2].y=i_coordy[i_vertex_index[2]];\r
+                       vertex[3].x=i_coordx[i_vertex_index[3]];\r
+                       vertex[3].y=i_coordy[i_vertex_index[3]];\r
+               \r
+                       //画像を取得\r
+                       if (!this._inst_patt.pickFromRaster(this._ref_raster,vertex)){\r
+                               return;\r
+                       }\r
+                       //取得パターンをカラー差分データに変換して評価する。\r
+                       this._deviation_data.setRaster(this._inst_patt);\r
+\r
+                       //最も一致するパターンを割り当てる。\r
+                       int square_index,direction;\r
+                       double confidence;\r
+                       this._match_patt[0].evaluate(this._deviation_data,mr);\r
+                       square_index=0;\r
+                       direction=mr.direction;\r
+                       confidence=mr.confidence;\r
+                       //2番目以降\r
+                       for(int i=1;i<this._match_patt.length;i++){\r
+                               this._match_patt[i].evaluate(this._deviation_data,mr);\r
+                               if (confidence > mr.confidence) {\r
+                                       continue;\r
+                               }\r
+                               // もっと一致するマーカーがあったぽい\r
+                               square_index = i;\r
+                               direction = mr.direction;\r
+                               confidence = mr.confidence;\r
+                       }\r
+                       //最も一致したマーカ情報を、この矩形の情報として記録する。\r
+                       final NyARDetectMarkerResult result = this.result_stack.prePush();\r
+                       result.arcode_id = square_index;\r
+                       result.confidence = confidence;\r
 \r
-       this.marker_width=i_marker_width;\r
-       //評価器を作る。\r
-       this.match_patt=new NyARMatchPatt_Color_WITHOUT_PCA();  \r
-    }\r
-    /**\r
-     * i_imageにマーカー検出処理を実行し、結果を記録します。\r
-     * @param i_image\r
-     * マーカーを検出するイメージを指定します。\r
-     * @param i_thresh\r
-     * 検出閾値を指定します。0~255の範囲で指定してください。\r
-     * 通常は100~130くらいを指定します。\r
-     * @return\r
-     * 見つかったマーカーの数を返します。\r
-     * マーカーが見つからない場合は0を返します。\r
-     * @throws NyARException\r
-     */\r
-    public int detectMarkerLite(NyARRaster i_image,int i_thresh) throws NyARException\r
-    {\r
-       NyARSquareList l_square_list=this.square_list;\r
-       //スクエアコードを探す\r
-       square.detectSquare(i_image, i_thresh,l_square_list);\r
+                       final NyARSquare sq=result.square;\r
+                       //directionを考慮して、squareを更新する。\r
+                       for(int i=0;i<4;i++){\r
+                               int idx=(i+4 - direction) % 4;\r
+                               this._coordline.coord2Line(i_vertex_index[idx],i_vertex_index[(idx+1)%4],i_coordx,i_coordy,i_coor_num,sq.line[i]);\r
+                       }\r
+                       for (int i = 0; i < 4; i++) {\r
+                               //直線同士の交点計算\r
+                               if(!NyARLinear.crossPos(sq.line[i],sq.line[(i + 3) % 4],sq.sqvertex[i])){\r
+                                       throw new NyARException();//ここのエラー復帰するならダブルバッファにすればOK\r
+                               }\r
+                       }\r
+               }\r
+               public void init(INyARRgbRaster i_raster)\r
+               {\r
+                       this._ref_raster=i_raster;\r
+                       this.result_stack.clear();\r
+                       \r
+               }\r
+       }       \r
+       private DetectSquareCB _detect_cb;\r
        \r
-       final int number_of_square=l_square_list.getSquareNum();\r
-       //コードは見つかった?\r
-       if(number_of_square<1){\r
-           //ないや。おしまい。\r
-           return 0;\r
-       }\r
-       //保持リストのサイズを調整\r
-       this.result_holder.reservHolder(number_of_square);      \r
        \r
-       //1スクエア毎に、一致するコードを決定していく\r
-       for(int i=0;i<number_of_square;i++)\r
+       private static final int AR_SQUARE_MAX = 300;\r
+       private boolean _is_continue = false;\r
+       private NyARSquareContourDetector _square_detect;\r
+       protected INyARTransMat _transmat;\r
+       private NyARRectOffset[] _offset;       \r
+\r
+\r
+       /**\r
+        * 複数のマーカーを検出し、最も一致するARCodeをi_codeから検索するオブジェクトを作ります。\r
+        * \r
+        * @param i_param\r
+        * カメラパラメータを指定します。\r
+        * @param i_code\r
+        * 検出するマーカーのARCode配列を指定します。\r
+        * 配列要素のインデックス番号が、そのままgetARCodeIndex関数で得られるARCodeインデックスになります。 \r
+        * 例えば、要素[1]のARCodeに一致したマーカーである場合は、getARCodeIndexは1を返します。\r
+        * @param i_marker_width\r
+        * i_codeのマーカーサイズをミリメートルで指定した配列を指定します。 先頭からi_number_of_code個の要素には、有効な値を指定する必要があります。\r
+        * @param i_number_of_code\r
+        * i_codeに含まれる、ARCodeの数を指定します。\r
+        * @param i_input_raster_type\r
+        * 入力ラスタのピクセルタイプを指定します。この値は、INyARBufferReaderインタフェイスのgetBufferTypeの戻り値を指定します。\r
+        * @throws NyARException\r
+        */\r
+       public NyARDetectMarker(NyARParam i_param,NyARCode[] i_code,double[] i_marker_width, int i_number_of_code,int i_input_raster_type) throws NyARException\r
        {\r
-           NyARSquare square=l_square_list.getSquare(i);\r
-           //評価基準になるパターンをイメージから切り出す\r
-            if(!this.patt.pickFromRaster(i_image,square)){\r
-               //イメージの切り出しは失敗することもある。\r
-               continue;\r
-            }\r
-            //パターンを評価器にセット\r
-            if(!this.match_patt.setPatt(this.patt)){\r
-                //計算に失敗した。     \r
-                throw new NyARException();\r
-            }\r
-            //コードと順番に比較していく\r
-            int code_index=0;\r
-            match_patt.evaluate(codes[0]);\r
-            double confidence=match_patt.getConfidence();\r
-            int direction=match_patt.getDirection();\r
-            for(int i2=1;i2<this.number_of_code;i2++)\r
-            {\r
-                //コードと比較する\r
-                match_patt.evaluate(codes[i2]);\r
-                double c2=match_patt.getConfidence();\r
-                if(confidence>c2){\r
-                    continue;\r
-                }\r
-                //より一致するARCodeの情報を保存\r
-                code_index  =i2;\r
-                direction   =match_patt.getDirection();\r
-                confidence  =c2;\r
-            }\r
-            //i番目のパターン情報を保存する。\r
-            final NyARDetectMarkerResult result=this.result_holder.result_array[i];\r
-            result.arcode_id =code_index;\r
-            result.confidence=confidence;\r
-            result.direction =direction;\r
-            result.ref_square=square;\r
+               initInstance(i_param,i_code,i_marker_width,i_number_of_code,i_input_raster_type);\r
+               return;\r
        }\r
-       return number_of_square;\r
-    }\r
-    /**\r
-     * i_indexのマーカーに対する変換行列を計算し、結果値をo_resultへ格納します。\r
-     * 直前に実行したdetectMarkerLiteが成功していないと使えません。\r
-     * @param i_index\r
-     * マーカーのインデックス番号を指定します。\r
-     * 直前に実行したdetectMarkerLiteの戻り値未満かつ0以上である必要があります。\r
-     * @param o_result\r
-     * 結果値を受け取るオブジェクトを指定してください。\r
-     * @throws NyARException\r
-     */\r
-    public void getTransmationMatrix(int i_index,NyARTransMatResult o_result) throws NyARException\r
-    {\r
-       final NyARDetectMarkerResult result=this.result_holder.result_array[i_index];\r
-       //一番一致したマーカーの位置とかその辺を計算\r
-       if(is_continue){\r
-           transmat.transMatContinue(result.ref_square,result.direction,marker_width[result.arcode_id],o_result);\r
-       }else{\r
-           transmat.transMat(result.ref_square,result.direction,marker_width[result.arcode_id],o_result);\r
+       protected void initInstance(\r
+               NyARParam       i_ref_param,\r
+               NyARCode[]      i_ref_code,\r
+               double[]        i_marker_width,\r
+               int                     i_number_of_code,\r
+               int i_input_raster_type) throws NyARException\r
+       {\r
+\r
+               final NyARIntSize scr_size=i_ref_param.getScreenSize();\r
+               // 解析オブジェクトを作る\r
+               final int cw = i_ref_code[0].getWidth();\r
+               final int ch = i_ref_code[0].getHeight();\r
+\r
+               //detectMarkerのコールバック関数\r
+               this._detect_cb=new DetectSquareCB(\r
+                       new NyARColorPatt_Perspective_O2(cw, ch,4,25),\r
+                       i_ref_code,i_number_of_code,i_ref_param);\r
+               this._transmat = new NyARTransMat(i_ref_param);\r
+               //NyARToolkitプロファイル\r
+               this._square_detect =new NyARSquareContourDetector_Rle(i_ref_param.getDistortionFactor(),i_ref_param.getScreenSize());\r
+               this._tobin_filter=new NyARRasterFilter_ARToolkitThreshold(100,i_input_raster_type);\r
+\r
+               //実サイズ保存\r
+               this._offset = NyARRectOffset.createArray(i_number_of_code);\r
+               for(int i=0;i<i_number_of_code;i++){\r
+                       this._offset[i].setSquare(i_marker_width[i]);\r
+               }\r
+               //2値画像バッファを作る\r
+               this._bin_raster=new NyARBinRaster(scr_size.w,scr_size.h);\r
+               return;         \r
        }\r
-       return;\r
-    }\r
-    /**\r
-     * i_indexのマーカーの一致度を返します。\r
-     * @param i_index\r
-     * マーカーのインデックス番号を指定します。\r
-     * 直前に実行したdetectMarkerLiteの戻り値未満かつ0以上である必要があります。\r
-     * @return\r
-     * マーカーの一致度を返します。0~1までの値をとります。\r
-     * 一致度が低い場合には、誤認識の可能性が高くなります。\r
-     * @throws NyARException\r
-     */\r
-    public double getConfidence(int i_index)\r
-    {\r
-       return this.result_holder.result_array[i_index].confidence;\r
-    }\r
-    /**\r
-     * i_indexのマーカーの方位を返します。\r
-     * @param i_index\r
-     * マーカーのインデックス番号を指定します。\r
-     * 直前に実行したdetectMarkerLiteの戻り値未満かつ0以上である必要があります。\r
-     * @return\r
-     * 0,1,2,3の何れかを返します。\r
-     */    \r
-    public int getDirection(int i_index)\r
-    {\r
-       return this.result_holder.result_array[i_index].direction;\r
-    }\r
-    /**\r
-     * i_indexのマーカーのARCodeインデックスを返します。\r
-     * @param i_index\r
-     * マーカーのインデックス番号を指定します。\r
-     * 直前に実行したdetectMarkerLiteの戻り値未満かつ0以上である必要があります。\r
-     * @return\r
-     */    \r
-    public int getARCodeIndex(int i_index)\r
-    {\r
-       return this.result_holder.result_array[i_index].arcode_id;\r
-    }    \r
-    /**\r
-     * getTransmationMatrixの計算モードを設定します。\r
-     * @param i_is_continue\r
-     * TRUEなら、transMatContinueを使用します。\r
-     * FALSEなら、transMatを使用します。\r
-     */\r
-    public void setContinueMode(boolean i_is_continue)\r
-    {\r
-       this.is_continue=i_is_continue;\r
-    }\r
        \r
-}\r
+       private NyARBinRaster _bin_raster;\r
 \r
-       \r
+       private INyARRasterFilter_Rgb2Bin _tobin_filter;\r
 \r
-       \r
-       \r
-       \r
-       \r
-       \r
-       \r
+       /**\r
+        * i_imageにマーカー検出処理を実行し、結果を記録します。\r
+        * \r
+        * @param i_raster\r
+        * マーカーを検出するイメージを指定します。\r
+        * @param i_thresh\r
+        * 検出閾値を指定します。0~255の範囲で指定してください。 通常は100~130くらいを指定します。\r
+        * @return 見つかったマーカーの数を返します。 マーカーが見つからない場合は0を返します。\r
+        * @throws NyARException\r
+        */\r
+       public int detectMarkerLite(INyARRgbRaster i_raster, int i_threshold) throws NyARException\r
+       {\r
+               // サイズチェック\r
+               if (!this._bin_raster.getSize().isEqualSize(i_raster.getSize())) {\r
+                       throw new NyARException();\r
+               }\r
 \r
-       \r
+               // ラスタを2値イメージに変換する.\r
+               ((NyARRasterFilter_ARToolkitThreshold)this._tobin_filter).setThreshold(i_threshold);\r
+               this._tobin_filter.doFilter(i_raster, this._bin_raster);\r
 \r
+               //detect\r
+               this._detect_cb.init(i_raster);\r
+               this._square_detect.detectMarkerCB(this._bin_raster,this._detect_cb);\r
 \r
-       \r
+               //見付かった数を返す。\r
+               return this._detect_cb.result_stack.getLength();\r
+       }\r
+\r
+       /**\r
+        * i_indexのマーカーに対する変換行列を計算し、結果値をo_resultへ格納します。 直前に実行したdetectMarkerLiteが成功していないと使えません。\r
+        * \r
+        * @param i_index\r
+        * マーカーのインデックス番号を指定します。 直前に実行したdetectMarkerLiteの戻り値未満かつ0以上である必要があります。\r
+        * @param o_result\r
+        * 結果値を受け取るオブジェクトを指定してください。\r
+        * @throws NyARException\r
+        */\r
+       public void getTransmationMatrix(int i_index, NyARTransMatResult o_result) throws NyARException\r
+       {\r
+               final NyARDetectMarkerResult result = this._detect_cb.result_stack.getItem(i_index);\r
+               // 一番一致したマーカーの位置とかその辺を計算\r
+               if (_is_continue) {\r
+                       _transmat.transMatContinue(result.square, this._offset[result.arcode_id], o_result);\r
+               } else {\r
+                       _transmat.transMat(result.square, this._offset[result.arcode_id], o_result);\r
+               }\r
+               return;\r
+       }\r
 \r
+       /**\r
+        * i_indexのマーカーの一致度を返します。\r
+        * \r
+        * @param i_index\r
+        * マーカーのインデックス番号を指定します。 直前に実行したdetectMarkerLiteの戻り値未満かつ0以上である必要があります。\r
+        * @return マーカーの一致度を返します。0~1までの値をとります。 一致度が低い場合には、誤認識の可能性が高くなります。\r
+        * @throws NyARException\r
+        */\r
+       public double getConfidence(int i_index)\r
+       {\r
+               return this._detect_cb.result_stack.getItem(i_index).confidence;\r
+       }\r
+       /**\r
+        * i_indexのマーカーのARCodeインデックスを返します。\r
+        * \r
+        * @param i_index\r
+        * マーカーのインデックス番号を指定します。 直前に実行したdetectMarkerLiteの戻り値未満かつ0以上である必要があります。\r
+        * @return\r
+        */\r
+       public int getARCodeIndex(int i_index)\r
+       {\r
+               return this._detect_cb.result_stack.getItem(i_index).arcode_id;\r
+       }\r
+\r
+       /**\r
+        * getTransmationMatrixの計算モードを設定します。\r
+        * \r
+        * @param i_is_continue\r
+        * TRUEなら、transMatContinueを使用します。 FALSEなら、transMatを使用します。\r
+        */\r
+       public void setContinueMode(boolean i_is_continue)\r
+       {\r
+               this._is_continue = i_is_continue;\r
+       }\r
+\r
+}\r