/**
         * この関数は、インスタンスを初期化します。
         * 継承先のクラスから呼び出してください。
         * @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;
        }
        protected void initInstance(
            INyARColorPatt i_patt_inst,
            NyARSquareContourDetector i_sqdetect_inst,
            INyARTransMat i_transmat_inst,
            INyARRasterFilter_Rgb2Bin i_filter,
            NyARParam i_ref_param,
            NyARCode i_ref_code,
            double i_marker_width)
        {
            NyARIntSize scr_size = i_ref_param.getScreenSize();

            // 解析オブジェクトを作る
            this._square_detect = i_sqdetect_inst;
            this._transmat      = i_transmat_inst;
            this._tobin_filter  = i_filter;
            //2値画像バッファを作る
            this._bin_raster = new NyARBinRaster(scr_size.w, scr_size.h);
            //パターンの一致検索処理用
            this._inst_patt      = i_patt_inst;
            this._deviation_data = new NyARMatchPattDeviationColorData(i_ref_code.getWidth(), i_ref_code.getHeight());
            this._coordline      = new NyARCoord2Linear(i_ref_param.getScreenSize(), i_ref_param.getDistortionFactor());
            this._match_patt     = new NyARMatchPatt_Color_WITHOUT_PCA(i_ref_code);
            //オフセットを作成
            this._offset = new NyARRectOffset();
            this._offset.setSquare(i_marker_width);
            return;
        }
Ejemplo n.º 3
0
        protected void initInstance(
            NyARParam i_ref_param,
            NyARCode[] i_ref_code,
            double[] i_marker_width,
            int i_number_of_code,
            int i_input_raster_type)
        {
            NyARIntSize scr_size = i_ref_param.getScreenSize();
            // 解析オブジェクトを作る
            int cw = i_ref_code[0].getWidth();
            int ch = i_ref_code[0].getHeight();

            //detectMarkerのコールバック関数
            this._detect_cb = new DetectSquareCB(
                new NyARColorPatt_Perspective_O2(cw, ch, 4, 25),
                i_ref_code, i_number_of_code, i_ref_param);
            this._transmat = new NyARTransMat(i_ref_param);
            //NyARToolkitプロファイル
            this._square_detect = new NyARSquareContourDetector_Rle(i_ref_param.getScreenSize());
            this._tobin_filter  = new NyARRasterFilter_ARToolkitThreshold(100, i_input_raster_type);

            //実サイズ保存
            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;
        }
        /**
         * この関数は、インスタンスを初期化します。
         * コンストラクタから呼び出します。
         * @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;
        }
Ejemplo n.º 5
0
        public NyARMarkerSystem(INyARMarkerSystemConfig i_config)
            : base(i_config.getNyARSingleCameraView())
        {
            this._sqdetect = new SquareDetect(i_config);
            this._hist_th  = i_config.createAutoThresholdArgorism();

            this._armk_list     = new ARMarkerList();
            this._idmk_list     = new NyIdList();
            this._psmk_list     = new ARPlayCardList();
            this._tracking_list = new TrackingList();
            this._transmat      = i_config.createTransmatAlgorism();
            this._on_sq_handler = new OnSquareDetect(this._view.getARParam(), this._armk_list, this._idmk_list, this._psmk_list, this._tracking_list, INITIAL_MARKER_STACK_SIZE);
        }
Ejemplo n.º 6
0
        /**
         * コンストラクタです。{@link INyARMarkerSystemConfig}を元に、インスタンスを生成します。
         * @param i_config
         * 初期化済の{@link MarkerSystem}を指定します。
         * @throws NyARException
         */
        public NyARMarkerSystem(INyARMarkerSystemConfig i_config)
            : base(i_config.getNyARParam())
        {
            this.initInstance(i_config);

            this._armk_list     = new ARMarkerList();
            this._idmk_list     = new NyIdList();
            this._psmk_list     = new ARPlayCardList();
            this._tracking_list = new TrackingList();
            this._transmat      = i_config.createTransmatAlgorism();
            //同時に判定待ちにできる矩形の数
            this._on_sq_handler = new OnSquareDetect(i_config, this._armk_list, this._idmk_list, this._psmk_list, this._tracking_list, INITIAL_MARKER_STACK_SIZE);
        }
	/**
	 * コンストラクタです。{@link INyARMarkerSystemConfig}を元に、インスタンスを生成します。
	 * @param i_config
	 * 初期化済の{@link MarkerSystem}を指定します。
	 * @throws NyARException
	 */
    public NyARMarkerSystem(INyARMarkerSystemConfig i_config)
        : base(i_config.getNyARParam())
	{
		this.initInstance(i_config);
		
		this._armk_list=new ARMarkerList();
		this._idmk_list=new NyIdList();
        this._psmk_list = new ARPlayCardList();
		this._tracking_list=new TrackingList();
		this._transmat=i_config.createTransmatAlgorism();
		//同時に判定待ちにできる矩形の数
        this._on_sq_handler = new OnSquareDetect(i_config, this._armk_list, this._idmk_list, this._psmk_list, this._tracking_list, INITIAL_MARKER_STACK_SIZE);
    }
        /**
         * コンストラクタです。{@link INyARMarkerSystemConfig}を元に、インスタンスを生成します。
         * @param i_config
         * 初期化済の{@link MarkerSystem}を指定します。
         * @throws NyARException
         */
        public NyARMarkerSystem(INyARMarkerSystemConfig i_config)
        {
            this._ref_param = i_config.getNyARParam();
            this._frustum   = new NyARFrustum();
            this.initInstance(i_config);
            this.setProjectionMatrixClipping(FRUSTUM_DEFAULT_NEAR_CLIP, FRUSTUM_DEFAULT_FAR_CLIP);

            this._armk_list     = new ARMarkerList();
            this._idmk_list     = new NyIdList();
            this._tracking_list = new TrackingList();
            this._transmat      = i_config.createTransmatAlgorism();
            //同時に判定待ちにできる矩形の数
            this._sq_stack      = new SquareStack(INITIAL_MARKER_STACK_SIZE);
            this._on_sq_handler = new OnSquareDetect(i_config, this._armk_list, this._idmk_list, this._tracking_list, this._sq_stack);
        }
Ejemplo n.º 9
0
        /**
         * この関数は、インスタンスを初期化します。
         * 継承先のクラスから呼び出してください。
         * @param i_param
         * カメラパラメータオブジェクト。このサイズは、{@link #detectMarker}に入力する画像と同じサイズである必要があります。
         * @
         */
        protected void initInstance(NyARParam i_param)
        {
            //初期化済?
            Debug.Assert(this._initialized == false);

            NyARIntSize scr_size = i_param.getScreenSize();

            // 解析オブジェクトを作る
            this._transmat = new NyARTransMat(i_param);
            this._thdetect = new NyARHistogramAnalyzer_SlidePTile(15);

            // 2値画像バッファを作る
            this._gs_raster   = new NyARGrayscaleRaster(scr_size.w, scr_size.h);
            this._initialized = true;
            //コールバックハンドラ
            this._detectmarker = new DetectSquare(i_param);
            this._offset       = new NyARRectOffset();
            return;
        }
        protected void initInstance(NyARParam i_param, int i_raster_type)
        {
            //初期化済?
            Debug.Assert(this._initialized == false);

            NyARIntSize scr_size = i_param.getScreenSize();

            // 解析オブジェクトを作る
            this._transmat     = new NyARTransMat(i_param);
            this._tobin_filter = new NyARRasterFilter_ARToolkitThreshold(110, i_raster_type);

            // 2値画像バッファを作る
            this._bin_raster       = new NyARBinRaster(scr_size.w, scr_size.h);
            this._threshold_detect = new NyARRasterThresholdAnalyzer_SlidePTile(15, i_raster_type, 4);
            this._initialized      = true;
            //コールバックハンドラ
            this._detectmarker = new DetectSquare(i_param, i_raster_type);
            this._offset       = new NyARRectOffset();
            return;
        }
Ejemplo n.º 11
0
        /**
         * コンストラクタから呼び出す共通な初期化部分です。
         * @param i_dist_factor
         * @param i_prjmat
         * @throws NyARException
         */
        protected void InitInstance(NyARIntSize i_screen, double i_near, double i_far, NyARPerspectiveProjectionMatrix i_prjmat, INyARCameraDistortionFactor i_dist_factor)
        {
            int number_of_reality_target = this.MAX_LIMIT_KNOWN + this.MAX_LIMIT_UNKNOWN;

            //演算インスタンス
            this._transmat = new NyARTransMat(i_dist_factor, i_prjmat);

            //データインスタンス
            this._pool  = new NyARRealityTargetPool(number_of_reality_target, i_prjmat);
            this.target = new NyARRealityTargetList(number_of_reality_target);
            //Trackerの特性値
            this._tracker = new NyARTracker((this.MAX_LIMIT_KNOWN + this.MAX_LIMIT_UNKNOWN) * 2, 1, this.MAX_LIMIT_KNOWN * 2);
            //フラスタムの計算とスクリーンサイズの保存
            this._ref_prjmat = i_prjmat;
            this._frustum    = new NyARFrustum(i_prjmat, i_screen.w, i_screen.h, i_near, i_far);

            //初期化
            this._number_of_dead = this._number_of_unknown = this._number_of_known = 0;
            return;
        }
        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;
        }
        protected void initInstance(
            INyARColorPatt i_patt_inst,
            NyARSquareContourDetector i_sqdetect_inst,
            INyARTransMat i_transmat_inst,
            INyARRasterFilter_Rgb2Bin i_filter,
            NyARParam i_ref_param,
            NyARCode i_ref_code,
            double i_marker_width)
        {
            NyARIntSize scr_size = i_ref_param.getScreenSize();

            // 解析オブジェクトを作る
            this._square_detect = i_sqdetect_inst;
            this._transmat      = i_transmat_inst;
            this._tobin_filter  = i_filter;
            //2値画像バッファを作る
            this._bin_raster = new NyARBinRaster(scr_size.w, scr_size.h);
            //_detect_cb
            this._detect_cb = new DetectSquareCB(i_patt_inst, i_ref_code, i_ref_param);
            //オフセットを作成
            this._offset = new NyARRectOffset();
            this._offset.setSquare(i_marker_width);
            return;
        }
        /**
         * この関数は、インスタンスを初期化します。
         * 継承先のクラスから呼び出してください。
         * @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;

        }
        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 NyARSquareContourDetector_Rle(scr_size);
            this._transmat = new NyARTransMat(i_param);
            this._callback = new DetectSquareCB(i_param, i_encoder);

            // 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;

        }
Ejemplo n.º 16
0
	    /**
	     * コンストラクタから呼び出す共通な初期化部分です。
	     * @param i_dist_factor
	     * @param i_prjmat
	     * @throws NyARException
	     */
	    protected void initInstance(NyARIntSize i_screen,double i_near,double i_far,NyARPerspectiveProjectionMatrix i_prjmat,INyARCameraDistortionFactor i_dist_factor)
	    {
		    int number_of_reality_target=this.MAX_LIMIT_KNOWN+this.MAX_LIMIT_UNKNOWN;
		    //演算インスタンス
		    this._transmat=new NyARTransMat(i_dist_factor,i_prjmat);

		    //データインスタンス
		    this._pool=new NyARRealityTargetPool(number_of_reality_target,i_prjmat);
		    this.target=new NyARRealityTargetList(number_of_reality_target);
		    //Trackerの特性値
		    this._tracker=new NyARTracker((this.MAX_LIMIT_KNOWN+this.MAX_LIMIT_UNKNOWN)*2,1,this.MAX_LIMIT_KNOWN*2);
		    //フラスタムの計算とスクリーンサイズの保存
		    this._ref_prjmat=i_prjmat;
		    this._frustum=new NyARFrustum(i_prjmat,i_screen.w,i_screen.h, i_near, i_far);

		    //初期化
		    this._number_of_dead=this._number_of_unknown=this._number_of_known=0;
		    return;
	    }
        /**
         * コンストラクタです。{@link INyARMarkerSystemConfig}を元に、インスタンスを生成します。
         * @param i_config
         * 初期化済の{@link MarkerSystem}を指定します。
         * @throws NyARException
         */
        public NyARMarkerSystem(INyARMarkerSystemConfig i_config)
        {
            this._ref_param=i_config.getNyARParam();
            this._frustum=new NyARFrustum();
            this.initInstance(i_config);
            this.setProjectionMatrixClipping(FRUSTUM_DEFAULT_NEAR_CLIP, FRUSTUM_DEFAULT_FAR_CLIP);

            this._armk_list=new ARMarkerList();
            this._idmk_list=new NyIdList();
            this._tracking_list=new TrackingList();
            this._transmat=i_config.createTransmatAlgorism();
            //同時に判定待ちにできる矩形の数
            this._sq_stack=new SquareStack(INITIAL_MARKER_STACK_SIZE);
            this._on_sq_handler=new OnSquareDetect(i_config,this._armk_list,this._idmk_list,this._tracking_list,this._sq_stack);
        }
        protected void initInstance(
            INyARColorPatt i_patt_inst,
            NyARSquareContourDetector i_sqdetect_inst,
            INyARTransMat i_transmat_inst,
            INyARRasterFilter_Rgb2Bin i_filter,
            NyARParam i_ref_param,
            NyARCode i_ref_code,
            double i_marker_width)
        {
            NyARIntSize scr_size = i_ref_param.getScreenSize();
            // 解析オブジェクトを作る
            this._square_detect = i_sqdetect_inst;
            this._transmat = i_transmat_inst;
            this._tobin_filter = i_filter;
            //2値画像バッファを作る
            this._bin_raster = new NyARBinRaster(scr_size.w, scr_size.h);
            //_detect_cb
            this._detect_cb = new DetectSquareCB(i_patt_inst, i_ref_code, i_ref_param);
            //オフセットを作成
            this._offset = new NyARRectOffset();
            this._offset.setSquare(i_marker_width);
            return;

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

            NyARIntSize scr_size = i_param.getScreenSize();
            // 解析オブジェクトを作る
            this._transmat = new NyARTransMat(i_param);
            this._thdetect = new NyARHistogramAnalyzer_SlidePTile(15);

            // 2値画像バッファを作る
            this._gs_raster = new NyARGrayscaleRaster(scr_size.w, scr_size.h);
            this._initialized = true;
            //コールバックハンドラ
            this._detectmarker = new DetectSquare(i_param);
            this._offset = new NyARRectOffset();
            return;
        }
        protected void initInstance(NyARParam i_param, int i_raster_type)
        {
            //初期化済?
            Debug.Assert(this._initialized == false);

            NyARIntSize scr_size = i_param.getScreenSize();
            // 解析オブジェクトを作る
            this._square_detect = new NyARSquareContourDetector_Rle(scr_size);
            this._transmat = new NyARTransMat(i_param);
            this._tobin_filter = new NyARRasterFilter_ARToolkitThreshold(110, i_raster_type);

            // 2値画像バッファを作る
            this._bin_raster = new NyARBinRaster(scr_size.w, scr_size.h);
            this._threshold_detect = new NyARRasterThresholdAnalyzer_SlidePTile(15, i_raster_type, 4);
            this._initialized = true;
            //コールバックハンドラ
            this._detectmarker_cb = new DetectSquareCB(i_param);
            this._offset = new NyARRectOffset();
            return;
        }