Exemple #1
0
        /**
         * ImputStreamからARToolKit形式のマーカデータを読み込み、o_codeオブジェクトへ格納します。
         * @param i_stream
         * 読出し元のストリームです。
         * @param o_code
         * 出力先の{@link NyARCode}オブジェクトです。
         * @
         */
        public static void loadFromARToolKitFormFile(StreamReader i_stream, NyARCode o_code)
        {
            int           width      = o_code.getWidth();
            int           height     = o_code.getHeight();
            NyARRgbRaster tmp_raster = new NyARRgbRaster(width, height, NyARBufferType.INT1D_X8R8G8B8_32);

            //4個の要素をラスタにセットする。
            try
            {
                int[]    buf  = (int[])tmp_raster.getBuffer();
                string[] data = i_stream.ReadToEnd().Split(new Char[] { ' ', '\r', '\n' });
                //GBRAで一度読みだす。
                int idx = 0;
                for (int h = 0; h < 4; h++)
                {
                    idx = readBlock(data, idx, width, height, buf);
                    //ARCodeにセット(カラー)
                    o_code.getColorData(h).setRaster(tmp_raster);
                    o_code.getBlackWhiteData(h).setRaster(tmp_raster);
                }
            }
            catch (Exception e)
            {
                throw new NyARException(e);
            }
            tmp_raster = null;//ポイ
            return;
        }
Exemple #2
0
 /**
  * コンストラクタ。
  * 基準パターンを元に、評価インスタンスを生成します。
  * @param i_code_ref
  * セットする基準パターン
  */
 public NyARMatchPatt_BlackWhite(NyARCode i_code_ref)
 {
     //最適化定数の計算
     this._pixels = i_code_ref.getWidth() * i_code_ref.getHeight();
     //基準パターンをセット
     this._ref_code_patt = i_code_ref;
     return;
 }
 /**
  * コンストラクタ。
  * 基準パターンを元に、評価インスタンスを生成します。
  * @param i_code_ref
  * セットする基準パターン
  */
 public NyARMatchPatt_BlackWhite(NyARCode i_code_ref)
 {
     //最適化定数の計算
     this._pixels = i_code_ref.getWidth() * i_code_ref.getHeight();
     //基準パターンをセット
     this._ref_code_patt = i_code_ref;
     return;
 }
 /**
  * コンストラクタ。
  * 基準パターンを元に、インスタンスを生成します。
  * @param i_code_ref
  * セットする基準パターンの参照値
  */
 public NyARMatchPatt_Color_WITHOUT_PCA(NyARCode i_code_ref)
 {
     int w = i_code_ref.getWidth();
     int h = i_code_ref.getHeight();
     //最適化定数の計算
     this._rgbpixels = w * h * 3;
     this._optimize_for_mod = this._rgbpixels - (this._rgbpixels % 16);
     this.setARCode(i_code_ref);
     return;
 }
 /** */
 public MarkerInfoARMarker(NyARCode i_patt, int i_patt_edge_percentage, double i_patt_size)
     : base()
 {
     this.matchpatt = new NyARMatchPatt_Color_WITHOUT_PCA(i_patt);
     this.patt_edge_percentage = i_patt_edge_percentage;
     this.marker_offset.setSquare(i_patt_size);
     this.patt_w = i_patt.getWidth();
     this.patt_h = i_patt.getHeight();
     return;
 }
Exemple #6
0
        /**
         * コンストラクタ。
         * 基準パターンを元に、インスタンスを生成します。
         * @param i_code_ref
         * セットする基準パターンの参照値
         */
        public NyARMatchPatt_Color_WITHOUT_PCA(NyARCode i_code_ref)
        {
            int w = i_code_ref.getWidth();
            int h = i_code_ref.getHeight();

            //最適化定数の計算
            this._rgbpixels        = w * h * 3;
            this._optimize_for_mod = this._rgbpixels - (this._rgbpixels % 16);
            this.setARCode(i_code_ref);
            return;
        }
 public NyARSingleDetectMarker_NyARTK_FITTING_ARTKv2(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_ARToolKit(i_ref_param);
       this._square_detect = new NyARSingleDetectMarker_ARTKv2.ARTKDetector(this, i_ref_param.getScreenSize());
 }
 protected NyARSingleDetectMarker(NyARParam i_ref_param, NyARCode i_ref_code, double i_marker_width)
 {
     this._deviation_data = new NyARMatchPattDeviationColorData(i_ref_code.getWidth(), i_ref_code.getHeight());
       this._match_patt = new NyARMatchPatt_Color_WITHOUT_PCA(i_ref_code);
       this._offset = new NyARRectOffset();
       this._offset.setSquare(i_marker_width);
       this._coordline = new NyARCoord2Linear(i_ref_param.getScreenSize(), i_ref_param.getDistortionFactor());
       //2値画像バッファを作る
       NyARIntSize s = i_ref_param.getScreenSize();
       this._bin_raster = new NyARBinRaster(s.w, s.h);
 }
Exemple #9
0
 /**
  * ImputStreamからARToolKit形式のマーカデータを読み込み、o_codeオブジェクトへ格納します。
  * @param i_stream
  * 読出し元のストリームです。
  * @param o_code
  * 出力先の{@link NyARCode}オブジェクトです。
  * @
  */
 public static void loadFromARToolKitFormFile(StreamReader i_stream, NyARCode o_code)
 {
     int width = o_code.getWidth();
     int height = o_code.getHeight();
     NyARRgbRaster tmp_raster = new NyARRgbRaster(width, height, NyARBufferType.INT1D_X8R8G8B8_32);
     //4個の要素をラスタにセットする。
     try
     {
         int[] buf = (int[])tmp_raster.getBuffer();
         string[] data = i_stream.ReadToEnd().Split(new Char[] { ' ', '\r', '\n' });
         //GBRAで一度読みだす。
         int idx = 0;
         for (int h = 0; h < 4; h++)
         {
             idx = readBlock(data, idx, width, height, buf);
             //ARCodeにセット(カラー)
             o_code.getColorData(h).setRaster(tmp_raster);
             o_code.getBlackWhiteData(h).setRaster(tmp_raster);
         }
     }
     catch (Exception e)
     {
         throw new NyARException(e);
     }
     tmp_raster = null;//ポイ
     return;
 }