\r
private final NyARSquareStack _square_list = new NyARSquareStack(AR_SQUARE_MAX);\r
\r
- private NyARCode _code;\r
-\r
protected INyARTransMat _transmat;\r
\r
private double _marker_width;\r
this._square_detect = new NyARSquareDetector_Quad(i_param.getDistortionFactor(),scr_size);\r
this._transmat = new NyARTransMat_X2(i_param);\r
// 比較コードを保存\r
- this._code = i_code;\r
this._marker_width = i_marker_width;\r
// 評価パターンのホルダを作る\r
- this._patt = new NyARColorPatt_O3(_code.getWidth(), _code.getHeight());\r
- // 評価器を作る。\r
- this._match_patt = new NyARMatchPatt_Color_WITHOUT_PCA();\r
+ this._patt = new NyARColorPatt_O3(i_code.getWidth(), i_code.getHeight());\r
+ // i_codeに対応する評価器を作る。\r
+ this._match_patt = new NyARMatchPatt_Color_WITHOUT_PCA(i_code);\r
//2値画像バッファを作る\r
this._bin_raster=new NyARBinRaster(scr_size.w/2,scr_size.h/2);\r
+ //差分データインスタンスの作成\r
+ this._deviation_data=new NyARMatchPattDeviationColorData(i_code.getWidth(), i_code.getHeight());\r
+ \r
return;\r
}\r
\r
// private NyARRasterFilter_ARToolkitThreshold _tobin_filter=new NyARRasterFilter_ARToolkitThreshold(100);\r
private NyARRasterFilter_ARTTh_Quad _tobin_filter=new NyARRasterFilter_ARTTh_Quad(100);\r
\r
+ private final NyARMatchPattResult __detectMarkerLite_mr=new NyARMatchPattResult();\r
+ private NyARMatchPattDeviationColorData _deviation_data;\r
+\r
/**\r
* i_imageにマーカー検出処理を実行し、結果を記録します。\r
* \r
return false;\r
}\r
\r
- // 評価基準になるパターンをイメージから切り出す\r
- if (!this._patt.pickFromRaster(i_raster, (NyARSquare)l_square_list.getItem(0))) {\r
- // パターンの切り出しに失敗\r
- return false;\r
- }\r
- // パターンを評価器にセット\r
- if (!this._match_patt.setPatt(this._patt)) {\r
- // 計算に失敗した。\r
- throw new NyARException();\r
- }\r
- // コードと比較する\r
- this._match_patt.evaluate(this._code);\r
+ boolean result=false;\r
+ NyARMatchPattResult mr=this.__detectMarkerLite_mr;\r
int square_index = 0;\r
- int direction = this._match_patt.getDirection();\r
- double confidence = this._match_patt.getConfidence();\r
- for (int i = 1; i < number_of_square; i++) {\r
- // 次のパターンを取得\r
- this._patt.pickFromRaster(i_raster, (NyARSquare)l_square_list.getItem(i));\r
- // 評価器にセットする。\r
- this._match_patt.setPatt(this._patt);\r
- // コードと比較する\r
- this._match_patt.evaluate(this._code);\r
- double c2 = this._match_patt.getConfidence();\r
+ int direction = NyARSquare.DIRECTION_UNKNOWN;\r
+ double confidence = 0;\r
+ for(int i=0;i<number_of_square;i++){\r
+ // 評価基準になるパターンをイメージから切り出す\r
+ if (!this._patt.pickFromRaster(i_raster, (NyARSquare)l_square_list.getItem(i))){\r
+ continue;\r
+ }\r
+ //取得パターンをカラー差分データに変換して評価する。\r
+ this._deviation_data.setRaster(this._patt);\r
+ this._match_patt.evaluate(this._deviation_data,mr);\r
+\r
+ final double c2 = mr.confidence;\r
if (confidence > c2) {\r
continue;\r
}\r
// もっと一致するマーカーがあったぽい\r
square_index = i;\r
- direction = this._match_patt.getDirection();\r
+ direction = mr.direction;\r
confidence = c2;\r
+ result=true;\r
}\r
+ \r
// マーカー情報を保存\r
this._detected_square = (NyARSquare)l_square_list.getItem(square_index);\r
this._detected_direction = direction;\r
this._detected_confidence = confidence;\r
- return true;\r
+ return false;\r
}\r
\r
/**\r