OSDN Git Service

[Backup]NyARToolkit for Java
[nyartoolkit-and/nyartoolkit-and.git] / trunk / src / jp / nyatla / nyartoolkit / detector / NyARCustomSingleDetectMarker.java
index 01c10b7..27c4389 100644 (file)
@@ -7,26 +7,25 @@
  *   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
@@ -52,7 +51,7 @@ import jp.nyatla.nyartoolkit.core.squaredetect.*;
  * \r
  */\r
 public class NyARCustomSingleDetectMarker\r
-{\r
+{      \r
        private static final int AR_SQUARE_MAX = 100;\r
 \r
        private boolean _is_continue = false;\r
@@ -74,41 +73,37 @@ public class NyARCustomSingleDetectMarker
        protected INyARRasterFilter_RgbToBin _tobin_filter;\r
 \r
        private NyARMatchPattDeviationColorData _deviation_data;\r
-       /**\r
-        * 検出するARCodeとカメラパラメータから、1個のARCodeを検出するNyARSingleDetectMarkerインスタンスを作ります。\r
-        * \r
-        * @param i_param\r
-        * カメラパラメータを指定します。\r
-        * @param i_code\r
-        * 検出するARCodeを指定します。\r
-        * @param i_marker_width\r
-        * ARコードの物理サイズを、ミリメートルで指定します。\r
-        * @param i_filter\r
-        * RGB→BIN変換フィルタを指定します。\r
-        * @throws NyARException\r
-        */\r
-       public NyARCustomSingleDetectMarker(NyARParam i_param, NyARCode i_code, double i_marker_width,INyARRasterFilter_RgbToBin i_filter) throws NyARException\r
+\r
+       protected NyARCustomSingleDetectMarker()\r
        {\r
-               final NyARIntSize scr_size=i_param.getScreenSize();             \r
+               return;\r
+       }\r
+       protected void initInstance(\r
+               INyARColorPatt i_patt_inst,\r
+               INyARSquareDetector i_sqdetect_inst,\r
+               INyARTransMat i_transmat_inst,\r
+               INyARRasterFilter_RgbToBin i_filter,\r
+               NyARParam       i_ref_param,\r
+               NyARCode        i_ref_code,\r
+               double          i_marker_width) throws NyARException\r
+       {\r
+               final NyARIntSize scr_size=i_ref_param.getScreenSize();         \r
                // 解析オブジェクトを作る\r
-//             this._square_detect = new NyARSquareDetector_ARToolKit(i_param.getDistortionFactor(),scr_size);\r
-               this._square_detect = new NyARSquareDetector_Rle(i_param.getDistortionFactor(),scr_size);\r
-               this._transmat = new NyARTransMat(i_param);\r
+               this._square_detect = i_sqdetect_inst;\r
+               this._transmat = i_transmat_inst;\r
+               this._tobin_filter=i_filter;\r
                // 比較コードを保存\r
                this._marker_width = i_marker_width;\r
                //パターンピックアップを作成\r
-//             this._patt = new NyARColorPatt_O1(i_code.getWidth(), i_code.getHeight());\r
-               this._patt = new NyARColorPatt_O3(i_code.getWidth(), i_code.getHeight());\r
-//             this._patt = new NyARColorPatt_Perspective(i_code.getWidth(), i_code.getHeight(),25);\r
+               this._patt = i_patt_inst;\r
                //取得パターンの差分データ器を作成\r
-               this._deviation_data=new NyARMatchPattDeviationColorData(i_code.getWidth(),i_code.getHeight());\r
+               this._deviation_data=new NyARMatchPattDeviationColorData(i_ref_code.getWidth(),i_ref_code.getHeight());\r
                //i_code用の評価器を作成\r
-               this._match_patt = new NyARMatchPatt_Color_WITHOUT_PCA(i_code);\r
-               \r
+               this._match_patt = new NyARMatchPatt_Color_WITHOUT_PCA(i_ref_code);\r
                //2値画像バッファを作る\r
                this._bin_raster=new NyARBinRaster(scr_size.w,scr_size.h);\r
-               this._tobin_filter=i_filter;\r
                return;\r
+               \r
        }\r
 \r
        private final NyARMatchPattResult __detectMarkerLite_mr=new NyARMatchPattResult();\r