Exemplo n.º 1
0
        /**
         * ターゲット座標系の4頂点でかこまれる領域を射影した平面から、RGB画像をo_rasterに取得します。
         * @param i_vertex
         * ターゲットのオフセットを基準値とした、頂点座標。要素数は4であること。(mm単位)
         * @param i_matrix
         * i_vertexに適応する変換行列。
         * ターゲットの姿勢行列を指定すると、ターゲット座標系になります。不要ならばnullを設定してください。
         * @param i_resolution
         * 1ピクセルあたりのサンプリング値(n^2表現)
         * @param o_raster
         * 出力ラスタ
         * @return
         * @throws NyARException
         * <p>メモ:この関数にはnewが残ってるので注意</p>
         */
        public bool getRgbPatt3d(NyARRealitySource i_src, NyARDoublePoint3d[] i_vertex, NyARDoubleMatrix44 i_matrix, int i_resolution, INyARRgbRaster o_raster)
        {
            Debug.Assert(this._target_type == RT_KNOWN);
            NyARDoublePoint2d[] da4 = this._ref_pool._wk_da2_4;
            NyARDoublePoint3d   v3d = new NyARDoublePoint3d();

            if (i_matrix != null)
            {
                //姿勢変換してから射影変換
                for (int i = 3; i >= 0; i--)
                {
                    //姿勢を変更して射影変換
                    i_matrix.transform3d(i_vertex[i], v3d);
                    this._transform_matrix.transform3d(v3d, v3d);
                    this._ref_pool._ref_prj_mat.project(v3d, da4[i]);
                }
            }
            else
            {
                //射影変換のみ
                for (int i = 3; i >= 0; i--)
                {
                    //姿勢を変更して射影変換
                    this._transform_matrix.transform3d(i_vertex[i], v3d);
                    this._ref_pool._ref_prj_mat.project(v3d, da4[i]);
                }
            }
            //パターンの取得
            return(i_src.refPerspectiveRasterReader().copyPatt(da4, 0, 0, i_resolution, o_raster));
        }
Exemplo n.º 2
0
        /**
         * RealityTargetに最も一致するパターンをテーブルから検索して、メタデータを返します。
         * @param i_target
         * Realityが検出したターゲット。
         * Unknownターゲットを指定すること。
         * @param i_rtsorce
         * i_targetを検出したRealitySourceインスタンス。
         * @param o_result
         * 返却値を格納するインスタンスを設定します。
         * 返却値がtrueの場合のみ、内容が更新されています。
         * @return
         * 特定に成功すると、trueを返します。
         * @throws NyARException
         */
        public bool getBestMatchTarget(NyARRealityTarget i_target, NyARRealitySource i_rtsorce, GetBestMatchTargetResult o_result)
        {
            //パターン抽出
            NyARMatchPattResult  tmp_patt_result = this.__tmp_patt_result;
            INyARPerspectiveCopy r = i_rtsorce.refPerspectiveRasterReader();

            r.copyPatt(i_target.refTargetVertex(), this._edge_x, this._edge_y, this._sample_per_pix, this._tmp_raster);
            //比較パターン生成
            this._deviation_data.setRaster(this._tmp_raster);
            int    ret = -1;
            int    dir = -1;
            double cf  = Double.MinValue;

            for (int i = this._table.getLength() - 1; i >= 0; i--)
            {
                this._match_patt.setARCode(this._table.getItem(i).code);
                this._match_patt.evaluate(this._deviation_data, tmp_patt_result);
                if (cf < tmp_patt_result.confidence)
                {
                    ret = i;
                    cf  = tmp_patt_result.confidence;
                    dir = tmp_patt_result.direction;
                }
            }
            if (ret < 0)
            {
                return(false);
            }
            //戻り値を設定
            MarkerTable.SerialTableRow row = this._table.getItem(ret);
            o_result.artk_direction = dir;
            o_result.confidence     = cf;
            o_result.idtag          = row.idtag;
            o_result.marker_height  = row.marker_height;
            o_result.marker_width   = row.marker_width;
            o_result.name           = row.name;
            return(true);
        }
Exemplo n.º 3
0
 /**
  * カメラ座標系の4頂点でかこまれる領域から、RGB画像をo_rasterに取得します。
  * @param i_vertex
  * @param i_matrix
  * i_vertexに適応する変換行列。
  * ターゲットの姿勢行列を指定すると、ターゲット座標系になります。不要ならばnullを設定してください。
  * @param i_resolution
  * @param o_raster
  * @return
  * @throws NyARException
  */
 public bool getRgbPatt3d(NyARRealitySource i_src, NyARDoublePoint3d[] i_vertex, NyARDoubleMatrix44 i_matrix, int i_resolution, INyARRgbRaster o_raster)
 {
     NyARDoublePoint2d[] vx = NyARDoublePoint2d.createArray(4);
     if (i_matrix != null)
     {
         //姿勢変換してから射影変換
         NyARDoublePoint3d v3d = new NyARDoublePoint3d();
         for (int i = 3; i >= 0; i--)
         {
             i_matrix.transform3d(i_vertex[i], v3d);
             this._ref_prjmat.project(v3d, vx[i]);
         }
     }
     else
     {
         //射影変換のみ
         for (int i = 3; i >= 0; i--)
         {
             this._ref_prjmat.project(i_vertex[i], vx[i]);
         }
     }
     //パターンの取得
     return(i_src.refPerspectiveRasterReader().copyPatt(vx, 0, 0, i_resolution, o_raster));
 }
	    /**
	     * ターゲット座標系の4頂点でかこまれる領域を射影した平面から、RGB画像をo_rasterに取得します。
	     * @param i_vertex
	     * ターゲットのオフセットを基準値とした、頂点座標。要素数は4であること。(mm単位)
	     * @param i_matrix
	     * i_vertexに適応する変換行列。
	     * ターゲットの姿勢行列を指定すると、ターゲット座標系になります。不要ならばnullを設定してください。
	     * @param i_resolution
	     * 1ピクセルあたりのサンプリング値(n^2表現)
	     * @param o_raster
	     * 出力ラスタ
	     * @return
	     * @throws NyARException
	     * <p>メモ:この関数にはnewが残ってるので注意</p>
	     */
        public bool getRgbPatt3d(NyARRealitySource i_src, NyARDoublePoint3d[] i_vertex, NyARDoubleMatrix44 i_matrix, int i_resolution, INyARRgbRaster o_raster)
	    {
		    Debug.Assert(this._target_type==RT_KNOWN);
		    NyARDoublePoint2d[] da4=this._ref_pool._wk_da2_4;
		    NyARDoublePoint3d v3d=new NyARDoublePoint3d();
		    if(i_matrix!=null){
			    //姿勢変換してから射影変換
			    for(int i=3;i>=0;i--){
				    //姿勢を変更して射影変換
				    i_matrix.transform3d(i_vertex[i],v3d);
				    this._transform_matrix.transform3d(v3d,v3d);
				    this._ref_pool._ref_prj_mat.project(v3d,da4[i]);
			    }
		    }else{
			    //射影変換のみ
			    for(int i=3;i>=0;i--){
				    //姿勢を変更して射影変換
				    this._transform_matrix.transform3d(i_vertex[i],v3d);
				    this._ref_pool._ref_prj_mat.project(v3d,da4[i]);
			    }
		    }
		    //パターンの取得
		    return i_src.refPerspectiveRasterReader().copyPatt(da4,0,0,i_resolution, o_raster);
	    }
Exemplo n.º 5
0
	    /**
	     * カメラ座標系の4頂点でかこまれる領域から、RGB画像をo_rasterに取得します。
	     * @param i_vertex
	     * @param i_matrix
	     * i_vertexに適応する変換行列。
	     * ターゲットの姿勢行列を指定すると、ターゲット座標系になります。不要ならばnullを設定してください。
	     * @param i_resolution
	     * @param o_raster
	     * @return
	     * @throws NyARException
	     */
        public bool getRgbPatt3d(NyARRealitySource i_src, NyARDoublePoint3d[] i_vertex, NyARDoubleMatrix44 i_matrix, int i_resolution, INyARRgbRaster o_raster)
	    {
		    NyARDoublePoint2d[] vx=NyARDoublePoint2d.createArray(4);
		    if(i_matrix!=null){
			    //姿勢変換してから射影変換
			    NyARDoublePoint3d v3d=new NyARDoublePoint3d();
			    for(int i=3;i>=0;i--){
				    i_matrix.transform3d(i_vertex[i],v3d);
				    this._ref_prjmat.project(v3d,vx[i]);
			    }
		    }else{
			    //射影変換のみ
			    for(int i=3;i>=0;i--){
				    this._ref_prjmat.project(i_vertex[i],vx[i]);
			    }
		    }
		    //パターンの取得
            return i_src.refPerspectiveRasterReader().copyPatt(vx, 0, 0, i_resolution, o_raster);
	    }
Exemplo n.º 6
0
	    /**
	     * 画面座標系の4頂点でかこまれる領域から、RGB画像をo_rasterに取得します。
	     * @param i_vertex
	     * @param i_resolution
	     * 1ピクセルあたりのサンプル数です。二乗した値が実際のサンプル数になります。
	     * @param o_raster
	     * @return
	     * @throws NyARException
	     */
        public bool getRgbPatt2d(NyARRealitySource i_src, NyARDoublePoint2d[] i_vertex, int i_resolution, INyARRgbRaster o_raster)
	    {
		    return i_src.refPerspectiveRasterReader().copyPatt(i_vertex,0,0,i_resolution, o_raster);
	    }	
Exemplo n.º 7
0
 /**
  * 画面座標系の4頂点でかこまれる領域から、RGB画像をo_rasterに取得します。
  * @param i_vertex
  * @param i_resolution
  * 1ピクセルあたりのサンプル数です。二乗した値が実際のサンプル数になります。
  * @param o_raster
  * @return
  * @throws NyARException
  */
 public bool getRgbPatt2d(NyARRealitySource i_src, NyARDoublePoint2d[] i_vertex, int i_resolution, INyARRgbRaster o_raster)
 {
     return(i_src.refPerspectiveRasterReader().copyPatt(i_vertex, 0, 0, i_resolution, o_raster));
 }