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;
        }
 public DetectSquareCB(INyARColorPatt i_inst_patt, NyARCode i_ref_code, NyARParam i_param)
 {
     this._inst_patt      = i_inst_patt;
     this._deviation_data = new NyARMatchPattDeviationColorData(i_ref_code.getWidth(), i_ref_code.getHeight());
     this._coordline      = new Coord2Linear(i_param.getScreenSize(), i_param.getDistortionFactor());
     this._match_patt     = new NyARMatchPatt_Color_WITHOUT_PCA(i_ref_code);
     return;
 }
 public DetectSquareCB(INyARColorPatt i_inst_patt, NyARCode i_ref_code, NyARParam i_param)
 {
     this._inst_patt = i_inst_patt;
     this._deviation_data = new NyARMatchPattDeviationColorData(i_ref_code.getWidth(), i_ref_code.getHeight());
     this._coordline = new Coord2Linear(i_param.getScreenSize(), i_param.getDistortionFactor());
     this._match_patt = new NyARMatchPatt_Color_WITHOUT_PCA(i_ref_code);
     return;
 }
Example #4
0
 public void setNyARCodeTable(NyARCode[] i_ref_code, int i_code_resolution)
 {
     /*unmanagedで実装するときは、ここでリソース解放をすること。*/
     this._deviation_data = new NyARMatchPattDeviationColorData(i_code_resolution, i_code_resolution);
     this._inst_patt      = new NyARColorPatt_Perspective(i_code_resolution, i_code_resolution, 4, 25);
     this._match_patt     = new NyARMatchPatt_Color_WITHOUT_PCA[i_ref_code.Length];
     for (int i = 0; i < i_ref_code.Length; i++)
     {
         this._match_patt[i] = new NyARMatchPatt_Color_WITHOUT_PCA(i_ref_code[i]);
     }
 }
 public void setNyARCodeTable(NyARCode[] i_ref_code, int i_code_resolution)
 {
     /*unmanagedで実装するときは、ここでリソース解放をすること。*/
     this._deviation_data = new NyARMatchPattDeviationColorData(i_code_resolution, i_code_resolution);
     this._inst_patt = new NyARColorPatt_Perspective_O2(i_code_resolution, i_code_resolution, 4, 25);
     this._match_patt = new NyARMatchPatt_Color_WITHOUT_PCA[i_ref_code.Length];
     for (int i = 0; i < i_ref_code.Length; i++)
     {
         this._match_patt[i] = new NyARMatchPatt_Color_WITHOUT_PCA(i_ref_code[i]);
     }
 }
        /// <summary>
        /// Initialize a new SquareDetectionListener.
        /// </summary>
        /// <param name="patternMatchers">The pattern matchers with the marker data.</param>
        /// <param name="cameraParameters">The camera calibration data.</param>
        /// <param name="colorPattern">The used color pattern.</param>
        /// <param name="patternMatchDeviationData">The pattern match deviation data.</param>
        public SquareDetectionListener(List <PatternMatcher> patternMatchers, NyARParam cameraParameters, INyARColorPatt colorPattern, NyARMatchPattDeviationColorData patternMatchDeviationData)
        {
            this.patternMatchers           = patternMatchers;
            this.colorPattern              = colorPattern;
            this.patternMatchDeviationData = patternMatchDeviationData;
            this.coordinationMapper        = new Coord2Linear(cameraParameters.getScreenSize(), cameraParameters.getDistortionFactor());
            this.matrixCalculator          = new NyARTransMat(cameraParameters);
            this.points           = NyARIntPoint2d.createArray(4);
            this.evaluationResult = new NyARMatchPattResult();

            Reset();
        }
      /// <summary>
      /// Initialize a new SquareDetectionListener.
      /// </summary>
      /// <param name="patternMatchers">The pattern matchers with the marker data.</param>
      /// <param name="cameraParameters">The camera calibration data.</param>
      /// <param name="colorPattern">The used color pattern.</param>
      /// <param name="patternMatchDeviationData">The pattern match deviation data.</param>
      public SquareDetectionListener(List<PatternMatcher> patternMatchers, NyARParam cameraParameters, INyARColorPatt colorPattern, NyARMatchPattDeviationColorData patternMatchDeviationData)
      {
         this.patternMatchers = patternMatchers;
         this.colorPattern = colorPattern;
         this.patternMatchDeviationData = patternMatchDeviationData;
         this.coordinationMapper = new Coord2Linear(cameraParameters.getScreenSize(), cameraParameters.getDistortionFactor());
         this.matrixCalculator = new NyARTransMat(cameraParameters);
         this.points = NyARIntPoint2d.createArray(4);
         this.evaluationResult = new NyARMatchPattResult();

         Reset();
      }
            public RleDetector(INyARColorPatt i_inst_patt, NyARCode[] i_ref_code, int i_num_of_code, NyARParam i_param) : base(i_param.getScreenSize())
            {
                int cw = i_ref_code[0].getWidth();
                int ch = i_ref_code[0].getHeight();

                //NyARMatchPatt_Color_WITHOUT_PCA[]の作成
                this._match_patt    = new NyARMatchPatt_Color_WITHOUT_PCA[i_num_of_code];
                this._match_patt[0] = new NyARMatchPatt_Color_WITHOUT_PCA(i_ref_code[0]);
                for (int i = 1; i < i_num_of_code; i++)
                {
                    //解像度チェック
                    if (cw != i_ref_code[i].getWidth() || ch != i_ref_code[i].getHeight())
                    {
                        throw new NyARException();
                    }
                    this._match_patt[i] = new NyARMatchPatt_Color_WITHOUT_PCA(i_ref_code[i]);
                }
                this._inst_patt      = i_inst_patt;
                this._coordline      = new NyARCoord2Linear(i_param.getScreenSize(), i_param.getDistortionFactor());
                this._deviation_data = new NyARMatchPattDeviationColorData(cw, ch);
                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;
        }
        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;

        }