Esempio n. 1
0
        /**
         * i_raster上にあるi_vertexの頂点で定義される四角形のパターンから、一致するID値を特定します。
         * @param i_vertex
         * 4頂点の座標
         * @param i_raster
         * @param o_result
         * @return
         * @throws NyARException
         */
        public bool identifyId(NyARDoublePoint2d[] i_vertex, INyARRgbRaster i_raster, IdentifyIdResult o_result)
        {
            if (this._last_laster != i_raster)
            {
                this._gs_pix_reader = NyARGsPixelDriverFactory.createDriver(i_raster);
                this._last_laster   = i_raster;
            }
            if (!this._id_pickup.pickFromRaster(this._gs_pix_reader, i_vertex, this._temp_nyid_info, this._temp_nyid_param))
            {
                return(false);
            }
            if (!this._rb.Encode(this._temp_nyid_info, this._rb_dest))
            {
                return(false);
            }

            //SerialID引きする。
            SerialTable.SerialTableRow d = this._table.getItembySerialId(this._rb_dest.marker_id);
            if (d == null)
            {
                return(false);
            }

            //戻り値を設定
            o_result.marker_width   = d.marker_width;
            o_result.id             = this._rb_dest.marker_id;
            o_result.artk_direction = this._temp_nyid_param.direction;
            o_result.name           = d.name;
            return(true);
        }
Esempio n. 2
0
 /**
  * RealityTargetに一致するID値を特定します。
  * 複数のパターンにヒットしたときは、一番初めにヒットした項目を返します。
  * @param i_target
  * Realityが検出したターゲット。
  * Unknownターゲットを指定すること。
  * @param i_rtsorce
  * i_targetを検出したRealitySourceインスタンス。
  * @param o_result
  * 返却値を格納するインスタンスを設定します。
  * 返却値がtrueの場合のみ、内容が更新されています。
  * @return
  * 特定に成功すると、trueを返します。
  * @throws NyARException
  */
 public bool identifyId(NyARRealityTarget i_target, NyARRealitySource i_rtsorce, IdentifyIdResult o_result)
 {
     //NyARDoublePoint2d[] i_vertex,NyARRgbRaster i_raster,SelectResult o_result
     return(this.identifyId(
                ((NyARRectTargetStatus)(i_target._ref_tracktarget._ref_status)).vertex,
                i_rtsorce.refRgbSource(),
                o_result));
 }
        /**
         * i_raster上にあるi_vertexの頂点で定義される四角形のパターンから、一致するID値を特定します。
         * @param i_vertex
         * 4頂点の座標
         * @param i_raster
         * @param o_result
         * @return
         * @throws NyARException
         */
        public bool identifyId(NyARDoublePoint2d[] i_vertex, INyARRgbRaster i_raster, IdentifyIdResult o_result)
        {
            if (!this._id_pickup.pickFromRaster(i_raster, i_vertex, this._temp_nyid_info, this._temp_nyid_param))
            {
                return(false);
            }
            //受け付けられるControlDomainは0のみ
            if (this._temp_nyid_info.ctrl_domain != 0)
            {
                return(false);
            }
            //受け入れられるMaskは0のみ
            if (this._temp_nyid_info.ctrl_mask != 0)
            {
                return(false);
            }
            //受け入れられるModelは5未満
            if (this._temp_nyid_info.model >= 5)
            {
                return(false);
            }

            this._rb.createDataInstance();
            if (!this._rb.encode(this._temp_nyid_info, this._rb_dest))
            {
                return(false);
            }
            //SerialIDの再構成
            long s = 0;

            //最大4バイト繋げて1個のint値に変換
            for (int i = 0; i < this._rb_dest.length; i++)
            {
                s = (s << 8) | (uint)this._rb_dest.packet[i];
            }
            //SerialID引きする。
            SerialTable.SerialTableRow d = this._table.getItembySerialId(s);
            if (d == null)
            {
                return(false);
            }
            //戻り値を設定
            o_result.marker_width   = d.marker_width;
            o_result.id             = s;
            o_result.artk_direction = this._temp_nyid_param.direction;
            o_result.name           = d.name;
            return(true);
        }