Unity
/// Is thrown when the ny AR exception. ///
Inheritance: NyAR.Core.NyARRgbRaster
Example #1
0
 /// <summary>
 /// This is constructor.
 /// </summary>
 /// <param name='i_width'>
 /// width of internal raster.
 /// </param>
 /// <param name='i_height'>
 /// height of internal raster.
 /// </param>
 public NyARUnitySensor(int i_width, int i_height) : base(new NyARIntSize(i_width, i_height))
 {
     //Create internal raster (Texture2d does not required vertical flipping.)
     this._raster = new NyARUnityRaster(i_width, i_height, true);
     //update by internal raster
     base.update(this._raster);
 }
		/// <summary>
		/// This is constructor.
		/// </summary>
		/// <param name='i_width'>
		/// width of internal raster.
		/// </param>
		/// <param name='i_height'>
		/// height of internal raster.
		/// </param>
		public NyARUnitySensor(int i_width,int i_height): base(new NyARIntSize(i_width,i_height))
		{
	        //Create internal raster (Texture2d does not required vertical flipping.)
	        this._raster = new NyARUnityRaster(i_width,i_height,true);
	        //update by internal raster
	        base.update(this._raster);
		}
Example #3
0
 /// <summary>
 /// Update Internal Raster.
 /// </summary>
 /// <param name='i_input'>
 /// new texture image. Must be same size with Sensor size.
 /// </param>
 public void update(Texture2D i_input)
 {
     //update internal raster
     this._raster = new NyARUnityRaster(i_input, true);
     //@bug パフォーマンス劣化ポイント(Raster処理系の再生成が起こる!)
     base.update(this._raster);
 }
 public NyARUnityPSEye(PSEyeTexture i_ptx)
     : base(new NyARIntSize(i_ptx.Width,i_ptx.Height))
 {
     this._raster = new NyARUnityRaster(i_ptx.Width,i_ptx.Height,true);
     base.update(this._raster);
     this._ptx = i_ptx;
 }
        /** <summary>
         * This function is{@link #getMarkerPlaneImage(int, NyARSensor, int, int, int, int, int, int, int, int, INyARRgbRaster)}
         * It is a wrapper. The acquired image{@link #BufferedImage}I returned in the form.
         * </summary>
         * <param name="i_id"></param>
         * <param name="i_sensor"></param>
         * <param name="i_x1"></param>
         * <param name="i_y1"></param>
         * <param name="i_x2"></param>
         * <param name="i_y2"></param>
         * <param name="i_x3"></param>
         * <param name="i_y3"></param>
         * <param name="i_x4"></param>
         * <param name="i_y4"></param>
         * <param name="i_img"></param>
         * <returns></returns>
         **/

        public void getMarkerPlaneImage(int i_id, NyARSensor i_sensor, int i_x1, int i_y1, int i_x2, int i_y2, int i_x3, int i_y3, int i_x4, int i_y4, Texture2D i_img)
        {
            NyARUnityRaster bmr = new NyARUnityRaster(i_img);

            base.getMarkerPlaneImage(i_id, i_sensor, i_x1, i_y1, i_x2, i_y2, i_x3, i_y3, i_x4, i_y4, bmr);
            return;
        }
Example #6
0
 public NyARUnitySensor(int i_width, int i_height) : base(new NyARIntSize(i_width, i_height))
 {
     //RGBラスタの生成(Texture2Dは上下反転不要)
     this._raster = new NyARUnityRaster(i_width, i_height, true);
     //ラスタのセット
     base.update(this._raster);
 }
 public NyARUnitySensor(int i_width,int i_height)
     : base(new NyARIntSize(i_width,i_height))
 {
     //RGBラスタの生成(Texture2Dは上下反転不要)
     this._raster = new NyARUnityRaster(i_width,i_height,true);
     //ラスタのセット
     base.update(this._raster);
 }
 public NyARUnityWebCam(WebCamTexture i_wtx) : base(new NyARIntSize(i_wtx.requestedWidth, i_wtx.requestedHeight))
 {
     //RGBラスタの生成(Webtextureは上下反転必要)
     this._raster = new NyARUnityRaster(i_wtx.requestedWidth, i_wtx.requestedHeight, true);
     //ラスタのセット
     base.update(this._raster);
     this._wtx = i_wtx;
 }
Example #9
0
 public NyARUnityWebCam(WebCamTexture i_wtx) : base(new NyARIntSize(i_wtx.requestedWidth, i_wtx.requestedHeight))
 {
     //RGB(Webtexture need upside down) the generation of raster
     this._raster = new NyARUnityRaster(i_wtx.requestedWidth, i_wtx.requestedHeight, true);
     //Set of raster
     base.update(this._raster);
     this._wtx = i_wtx;
 }
 public NyARUnityWebCam(WebCamTexture i_wtx)
     : base(new NyARIntSize(i_wtx.requestedWidth,i_wtx.requestedHeight))
 {
     //RGB(Webtexture need upside down) the generation of raster
     this._raster = new NyARUnityRaster(i_wtx.requestedWidth,i_wtx.requestedHeight,true);
     //Set of raster
     base.update(this._raster);
     this._wtx=i_wtx;
 }
        /**
         * This function is{@link #getMarkerPlaneImage(int, NyARSensor, int, int, int, int, INyARRgbRaster)}
         * It is a wrapper. The acquired image{@link #BufferedImage}I returned in the form.
         * @param i_id
         * marker id
         * @param i_sensor
         * Object to retrieve the image sensor. Is usually{@link #update(NyARSensor)}I will be the same as it was entered into the function.
         * @param i_l
         * @param i_t
         * @param i_w
         * @param i_h
         * @param i_raster
         * Object where the output
         * @return
         * I have to store the result i_raster Object
         * @throws NyARException
         */
        public void getMarkerPlaneImage(int i_id, NyARSensor i_sensor, int i_l, int i_t, int i_w, int i_h, Texture2D i_img)
        {
            NyARUnityRaster bmr = new NyARUnityRaster(i_img.width, i_img.height, true);

            base.getMarkerPlaneImage(i_id, i_sensor, i_l, i_t, i_w, i_h, bmr);
            i_img.SetPixels32((Color32[])bmr.getBuffer());
            i_img.Apply();

            return;
        }
		/**
		 * WebcamTextureを元にインスタンスを生成します.
		 * 画像サイズを自分で設定できます.
		 * @param i_wtx
		 * Webカメラは開始されている必要があります.
		 * 
		 */
		protected NyARUnityWebCam(WebCamTexture i_wtx): base(new NyARIntSize(i_wtx.width,i_wtx.height))
		{
			//念のためチェック
			if(!i_wtx.isPlaying){
				throw new NyARException("WebCamTexture must be startings.");
			}
	        //RGBラスタの生成(Webtextureは上下反転必要)
	        this._raster = new NyARUnityRaster(i_wtx.width,i_wtx.height,true);
	        //ラスタのセット
	        base.update(this._raster);
			this._wtx=i_wtx;
		}
Example #13
0
 /**
  * WebcamTextureを元にインスタンスを生成します.
  * 画像サイズを自分で設定できます.
  * @param i_wtx
  * Webカメラは開始されている必要があります.
  *
  */
 protected NyARUnityWebCam(WebCamTexture i_wtx) : base(new NyARIntSize(i_wtx.width, i_wtx.height))
 {
     //念のためチェック
     if (!i_wtx.isPlaying)
     {
         throw new NyARException("WebCamTexture must be startings.");
     }
     //RGBラスタの生成(Webtextureは上下反転必要)
     _raster = new NyARUnityRaster(i_wtx.width, i_wtx.height, true);
     //ラスタのセット
     base.Update(_raster);
     _wtx = i_wtx;
 }
 /**
  * WebcamTextureを元にインスタンスを生成します.
  * 画像サイズを自分で設定できます.
  * @param i_wtx
  * Webカメラは開始されている必要があります.
  *
  */
 protected NyARUnityWebCam(WebCamTexture i_wtx) : base(new NyARIntSize(i_wtx.width, i_wtx.height))
 {
     //念のためチェック
     if (!i_wtx.isPlaying)
     {
         throw new NyARRuntimeException("WebCamTexture must be startings.");
     }
     //RGBラスタの生成(Webtextureは上下反転必要)
     this._raster = new NyARUnityRaster(new Texture2D(i_wtx.width, i_wtx.height, TextureFormat.RGBA32, false), true);
     //ラスタのセット
     base.update(this._raster);
     this._wtx = i_wtx;
 }
 /** <summary>
 * {@link #addARMarker(INyARRgbRaster, int, int, double)}It is a wrapper. I make a marker pattern from Bitmap.
 * The arguments are{@link #addARMarker(INyARRgbRaster, int, int, double)}Please refer to the.
 *
 * </summary>
 * <param name="i_img"></param>
 * <param name="i_patt_resolution">I specify the resolution of the marker to be generated.</param>
 * <param name="i_patt_edge_percentage">Specifies the percentage of the edge region of the image.</param>
 * <param name="i_marker_size">I specify the physical size of the marker.</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);
     //Marker pattern cut out from a raster
     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);
     //Set the pattern cut
     c.setRaster(tr);
     return base.addARMarker(c, i_patt_edge_percentage, i_marker_size);
 }
        /// <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));
        }
        /**
         * This function is{@link #getMarkerPlaneImage(int, NyARSensor, int, int, int, int, INyARRgbRaster)}
         * It is a wrapper. The acquired image{@link #BufferedImage}I returned in the form.
         * @param i_id
         * marker id
         * @param i_sensor
         * Object to retrieve the image sensor. Is usually{@link #update(NyARSensor)}I will be the same as it was entered into the function.
         * @param i_l
         * @param i_t
         * @param i_w
         * @param i_h
         * @param i_raster
         * Object where the output
         * @return
         * I have to store the result i_raster Object
         * @throws NyARException
         */
        public void getMarkerPlaneImage(int i_id, NyARSensor i_sensor, int i_l, int i_t, int i_w, int i_h, Texture2D i_img)
        {
            NyARUnityRaster bmr = new NyARUnityRaster(i_img.width,i_img.height,true);
            base.getMarkerPlaneImage(i_id, i_sensor, i_l, i_t, i_w, i_h, bmr);
            i_img.SetPixels32((Color32[])bmr.getBuffer());
            i_img.Apply();

            return;
        }
        public PerspectiveCopy_Unity(NyARUnityRaster i_ref_raster,bool i_inv_v)
        {
            System.Diagnostics.Debug.Assert(i_ref_raster.isEqualBufferType(NyARBufferType.OBJECT_CS));
			this._is_inv_v=i_inv_v;
            this._ref_raster = i_ref_raster;
        }
        public NyARRgb2GsFilterRgbAve_UnityRaster(NyARUnityRaster i_ref_raster,bool is_inverse)
        {
            System.Diagnostics.Debug.Assert(i_ref_raster.isEqualBufferType(NyARBufferType.OBJECT_CS_Unity));
            this._ref_raster = i_ref_raster;
			this._is_inverse = is_inverse;
        }
 public PerspectiveCopy_Unity(NyARUnityRaster i_ref_raster, bool i_inv_v)
 {
     System.Diagnostics.Debug.Assert(i_ref_raster.isEqualBufferType(NyARBufferType.OBJECT_CS));
     this._is_inv_v   = i_inv_v;
     this._ref_raster = i_ref_raster;
 }
 public NyARRgb2GsFilterRgbAve_UnityRaster(NyARUnityRaster i_ref_raster, bool is_inverse)
 {
     System.Diagnostics.Debug.Assert(i_ref_raster.isEqualBufferType(NyARBufferType.OBJECT_CS_Unity));
     this._ref_raster = i_ref_raster;
     this._is_inverse = is_inverse;
 }
 public NyARUnityPSEye(PSEyeTexture i_ptx) : base(new NyARIntSize(i_ptx.Width, i_ptx.Height))
 {
     this._raster = new NyARUnityRaster(i_ptx.Width, i_ptx.Height, true);
     base.update(this._raster);
     this._ptx = i_ptx;
 }
 /** <summary>
 * This function is{@link #getMarkerPlaneImage(int, NyARSensor, int, int, int, int, int, int, int, int, INyARRgbRaster)}
 * It is a wrapper. The acquired image{@link #BufferedImage}I returned in the form.
 * </summary>
 * <param name="i_id"></param>
 * <param name="i_sensor"></param>
 * <param name="i_x1"></param>
 * <param name="i_y1"></param>
 * <param name="i_x2"></param>
 * <param name="i_y2"></param>
 * <param name="i_x3"></param>
 * <param name="i_y3"></param>
 * <param name="i_x4"></param>
 * <param name="i_y4"></param>
 * <param name="i_img"></param>
 * <returns></returns>
 **/
 public void getMarkerPlaneImage(int i_id, NyARSensor i_sensor, int i_x1, int i_y1, int i_x2, int i_y2, int i_x3, int i_y3, int i_x4, int i_y4, Texture2D i_img)
 {
     NyARUnityRaster bmr = new NyARUnityRaster(i_img);
     base.getMarkerPlaneImage(i_id, i_sensor, i_x1, i_y1, i_x2, i_y2, i_x3, i_y3, i_x4, i_y4, bmr);
     return;
 }