/**
         * この関数は、インスタンスを初期化します。
         * 継承先のクラスから呼び出してください。
         * @param i_param
         * カメラパラメータオブジェクト。このサイズは、{@link #detectMarker}に入力する画像と同じサイズである必要があります。
         * @param i_encoder
         * IDマーカの値エンコーダを指定します。
         * @param i_marker_width
         * マーカの物理縦横サイズをmm単位で指定します。
         * @
         */
        protected void initInstance(NyARParam i_param, INyIdMarkerDataEncoder i_encoder, double i_marker_width)
        {
            //初期化済?
            Debug.Assert(this._initialized == false);

            NyARIntSize scr_size = i_param.getScreenSize();

            // 解析オブジェクトを作る
            this._square_detect = new RleDetector(
                i_param,
                i_encoder,
                new NyIdMarkerPickup());
            this._transmat = new NyARTransMat(i_param);

            // 2値画像バッファを作る
            this._gs_raster = new NyARGrayscaleRaster(scr_size.w, scr_size.h);
            this._histmaker = (INyARHistogramFromRaster)this._gs_raster.createInterface(typeof(INyARHistogramFromRaster));
            //ワーク用のデータオブジェクトを2個作る
            this._data_current     = i_encoder.createDataInstance();
            this._threshold_detect = new NyARHistogramAnalyzer_SlidePTile(15);
            this._initialized      = true;
            this._is_active        = false;
            this._offset           = new NyARRectOffset();
            this._offset.setSquare(i_marker_width);
            return;
        }
コード例 #2
0
        /**
         * この関数は、インスタンスを初期化します。
         * コンストラクタから呼び出します。
         * @see NyARDetectMarker#NyARDetectMarker(NyARParam, NyARCode[], double[], int, int)
         * @param i_ref_param
         * Check see also
         * @param i_ref_code
         * Check see also
         * @param i_marker_width
         * Check see also
         * @param i_number_of_code
         * Check see also
         * @param i_input_raster_type
         * Check see also
         * @
         */
        protected void initInstance(
            NyARParam i_ref_param,
            NyARCode[] i_ref_code,
            double[] i_marker_width,
            int i_number_of_code)
        {
            NyARIntSize scr_size = i_ref_param.getScreenSize();
            // 解析オブジェクトを作る
            int cw = i_ref_code[0].getWidth();
            int ch = i_ref_code[0].getHeight();

            this._transmat = new NyARTransMat(i_ref_param);
            //NyARToolkitプロファイル
            this._square_detect = new RleDetector(new NyARColorPatt_Perspective(cw, ch, 4, 25), i_ref_code, i_number_of_code, i_ref_param);

            //実サイズ保存
            this._offset = NyARRectOffset.createArray(i_number_of_code);
            for (int i = 0; i < i_number_of_code; i++)
            {
                this._offset[i].setSquare(i_marker_width[i]);
            }
            //2値画像バッファを作る
            this._bin_raster = new NyARBinRaster(scr_size.w, scr_size.h);
            return;
        }
コード例 #3
0
        /**
         * コンストラクタから呼び出す関数です。
         * @param i_ref_param
         * @param i_ref_code
         * @param i_marker_width
         * @param i_input_raster_type
         * @param i_profile_id
         * @throws NyARException
         */
        private void initialize(
            NyARParam i_ref_param,
            NyARCode i_ref_code,
            double i_marker_width,
            int i_input_raster_type,
            int i_profile_id)
        {
            NyARRasterFilter_ARToolkitThreshold th = new NyARRasterFilter_ARToolkitThreshold(100, i_input_raster_type);
            INyARColorPatt            patt_inst;
            NyARSquareContourDetector sqdetect_inst;
            INyARTransMat             transmat_inst;

            switch (i_profile_id)
            {
            case PF_ARTOOLKIT_COMPATIBLE:
                patt_inst     = new NyARColorPatt_O3(i_ref_code.getWidth(), i_ref_code.getHeight());
                sqdetect_inst = new ARTKDetector(this, i_ref_param.getScreenSize());
                transmat_inst = new NyARTransMat_ARToolKit(i_ref_param);
                break;

            case PF_NYARTOOLKIT_ARTOOLKIT_FITTING:
                patt_inst     = new NyARColorPatt_Perspective_O2(i_ref_code.getWidth(), i_ref_code.getHeight(), 4, 25, i_input_raster_type);
                sqdetect_inst = new RleDetector(this, i_ref_param.getScreenSize());
                transmat_inst = new NyARTransMat_ARToolKit(i_ref_param);
                break;

            case PF_NYARTOOLKIT:        //default
                //			patt_inst=new NyARColorPatt_Perspective(i_ref_code.getWidth(), i_ref_code.getHeight(),4,25);
                patt_inst     = new NyARColorPatt_Perspective_O2(i_ref_code.getWidth(), i_ref_code.getHeight(), 4, 25, i_input_raster_type);
                sqdetect_inst = new RleDetector(this, i_ref_param.getScreenSize());
                transmat_inst = new NyARTransMat(i_ref_param);
                break;

            default:
                throw new NyARException();
            }
            base.initInstance(patt_inst, sqdetect_inst, transmat_inst, th, i_ref_param, i_ref_code, i_marker_width);
        }
コード例 #4
0
        protected void initInstance(NyARParam i_param, INyIdMarkerDataEncoder i_encoder, double i_marker_width, int i_raster_format)
        {
            //初期化済?
            Debug.Assert(this._initialized == false);

            NyARIntSize scr_size = i_param.getScreenSize();

            // 解析オブジェクトを作る
            this._square_detect = new RleDetector(i_param, i_encoder);
            this._transmat      = new NyARTransMat(i_param);

            // 2値画像バッファを作る
            this._bin_raster = new NyARBinRaster(scr_size.w, scr_size.h);
            //ワーク用のデータオブジェクトを2個作る
            this._data_current     = i_encoder.createDataInstance();
            this._tobin_filter     = new NyARRasterFilter_ARToolkitThreshold(110, i_raster_format);
            this._threshold_detect = new NyARRasterThresholdAnalyzer_SlidePTile(15, i_raster_format, 4);
            this._initialized      = true;
            this._is_active        = false;
            this._offset           = new NyARRectOffset();
            this._offset.setSquare(i_marker_width);
            return;
        }
コード例 #5
0
 public NyARSingleDetectMarker_NyARTK(NyARParam i_ref_param, NyARCode i_ref_code, double i_marker_width) : base(i_ref_param, i_ref_code, i_marker_width)
 {
     this._inst_patt     = new NyARColorPatt_Perspective(i_ref_code.getWidth(), i_ref_code.getHeight(), 4, 25);
     this._transmat      = new NyARTransMat(i_ref_param);
     this._square_detect = new RleDetector(this, i_ref_param.getScreenSize());
 }
コード例 #6
0
 public NyARSingleDetectMarker_NyARTK(NyARParam i_ref_param, NyARCode i_ref_code, double i_marker_width)
     : base(i_ref_param, i_ref_code, i_marker_width)
 {
     this._inst_patt = new NyARColorPatt_Perspective(i_ref_code.getWidth(), i_ref_code.getHeight(), 4, 25);
       this._transmat = new NyARTransMat(i_ref_param);
       this._square_detect = new RleDetector(this, i_ref_param.getScreenSize());
 }
コード例 #7
0
        /**
         * この関数は、インスタンスを初期化します。
         * 継承先のクラスから呼び出してください。
         * @param i_param
         * カメラパラメータオブジェクト。このサイズは、{@link #detectMarker}に入力する画像と同じサイズである必要があります。
         * @param i_encoder
         * IDマーカの値エンコーダを指定します。
         * @param i_marker_width
         * マーカの物理縦横サイズをmm単位で指定します。
         * @
         */
        protected void initInstance(NyARParam i_param, INyIdMarkerDataEncoder i_encoder, double i_marker_width)
        {
            //初期化済?
            Debug.Assert(this._initialized == false);

            NyARIntSize scr_size = i_param.getScreenSize();
            // 解析オブジェクトを作る
            this._square_detect = new RleDetector(
                i_param,
                i_encoder,
                new NyIdMarkerPickup());
            this._transmat = new NyARTransMat(i_param);

            // 2値画像バッファを作る
            this._gs_raster = new NyARGrayscaleRaster(scr_size.w, scr_size.h);
            this._histmaker = (INyARHistogramFromRaster)this._gs_raster.createInterface(typeof(INyARHistogramFromRaster));
            //ワーク用のデータオブジェクトを2個作る
            this._data_current = i_encoder.createDataInstance();
            this._threshold_detect = new NyARHistogramAnalyzer_SlidePTile(15);
            this._initialized = true;
            this._is_active = false;
            this._offset = new NyARRectOffset();
            this._offset.setSquare(i_marker_width);
            return;

        }