/// <summary>
        /// {@link #addARMarker(INyARRgbRaster, int, int, double)}のラッパーです。Bitmapからマーカパターンを作ります。
        /// 引数については、{@link #addARMarker(INyARRgbRaster, int, int, double)}を参照してください。
        /// 
        /// </summary>
        /// <param name="i_img"></param>
        /// <param name="i_patt_resolution">生成するマーカの解像度を指定します。</param>
        /// <param name="i_patt_edge_percentage">画像のエッジ領域を%で指定します。</param>
        /// <param name="i_marker_size">マーカの物理サイズを指定します。</param>
        /// <returns></returns>
        public int addARMarker(Texture2D i_img, int i_patt_resolution, int i_patt_edge_percentage, double i_marker_size)
        {
            int w = i_img.width;
              int h = i_img.height;
              NyARUnityRaster ur = new NyARUnityRaster(i_img);
              NyARCode c = new NyARCode(i_patt_resolution, i_patt_resolution);

              //ラスタからマーカパターンを切り出す
              INyARPerspectiveCopy pc = (INyARPerspectiveCopy)ur.createInterface(typeof(INyARPerspectiveCopy));
              NyARRgbRaster tr = new NyARRgbRaster(i_patt_resolution, i_patt_resolution);
              pc.copyPatt(0, 0, w, 0, w, h, 0, h, i_patt_edge_percentage, i_patt_edge_percentage, 4, tr);

              //切り出したパターンをセット
              c.setRaster(tr);
              return base.addARMarker(c, i_patt_edge_percentage, i_marker_size);
        }
示例#2
0
 /**
  * この関数は、画像からARマーカパターンを生成して、登録します。
  * ビットマップ等の画像から生成したパターンは、撮影画像から生成したパターンファイルと比較して、撮影画像の色調変化に弱くなります。
  * 注意してください。
  * @param i_raster
  * マーカ画像を格納したラスタオブジェクト
  * @param i_patt_resolution
  * マーカの解像度
  * @param i_patt_edge_percentage
  * マーカのエッジ領域のサイズ。マーカパターンは、i_rasterからエッジ領域を除いたパターンから生成します。
  * ARToolKitスタイルの画像を用いる場合は、25を指定します。
  * @param i_marker_size
  * マーカの平方サイズ[mm]
  * @return
  * マーカID(ハンドル)値。
  * @throws NyARException
  */
 public int addARMarker(INyARRgbRaster i_raster, int i_patt_resolution, int i_patt_edge_percentage, double i_marker_size)
 {
     NyARCode c = new NyARCode(i_patt_resolution, i_patt_resolution);
       NyARIntSize s = i_raster.getSize();
       //ラスタからマーカパターンを切り出す。
       INyARPerspectiveCopy pc = (INyARPerspectiveCopy)i_raster.createInterface(typeof(INyARPerspectiveCopy));
       NyARRgbRaster tr = new NyARRgbRaster(i_patt_resolution, i_patt_resolution);
       pc.copyPatt(0, 0, s.w, 0, s.w, s.h, 0, s.h, i_patt_edge_percentage, i_patt_edge_percentage, 4, tr);
       //切り出したパターンをセット
       c.setRaster(tr);
       return this.addARMarker(c, i_patt_edge_percentage, i_marker_size);
 }