/**
         * ターゲット座標系の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));
        }
Exemple #2
0
        public INyARRgbRaster getPlaneImage(int i_id, NyARSensor i_sensor, double i_x1, double i_y1, double i_x2,
                                            double i_y2, double i_x3, double i_y3, double i_x4, double i_y4, INyARRgbRaster i_raster)
        {
            NyARDoublePoint3d[] pos  = this.__pos3d;
            NyARDoublePoint2d[] pos2 = this.__pos2d;
            NyARDoubleMatrix44  tmat = this.getTransformMatrix(i_id);

            tmat.transform3d(i_x1, i_y1, 0, pos[1]);
            tmat.transform3d(i_x2, i_y2, 0, pos[0]);
            tmat.transform3d(i_x3, i_y3, 0, pos[3]);
            tmat.transform3d(i_x4, i_y4, 0, pos[2]);
            for (int i = 3; i >= 0; i--)
            {
                this._view.getFrustum().project(pos[i], pos2[i]);
            }
            return(i_sensor.getPerspectiveImage(pos2[0].x, pos2[0].y, pos2[1].x, pos2[1].y, pos2[2].x, pos2[2].y,
                                                pos2[3].x, pos2[3].y, i_raster));
        }
Exemple #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));
 }