Esempio n. 1
0
        /// <summary>
        /// CvSURFPoint*から初期化
        /// </summary>
        /// <param name="ptr">CvSURFPoint*</param>
#else
        /// <summary>
        /// Initializes from native pointer
        /// </summary>
        /// <param name="ptr">CvSURFPoint*</param>
#endif
        public CvSURFPoint(IntPtr ptr)
        {
            if (ptr == IntPtr.Zero)
            {
                throw new ArgumentNullException("ptr");
            }
            try
            {
                CvSURFPoint p = (CvSURFPoint)Marshal.PtrToStructure(ptr, typeof(CvSURFPoint));
                Pt        = p.Pt;
                Laplacian = p.Laplacian;
                Size      = p.Size;
                Dir       = p.Dir;
                Hessian   = p.Hessian;
            }
            catch
            {
                throw new InvalidCastException();
            }
        }
Esempio n. 2
0
        /// <summary>
        /// 箱の頂点を見つける
        /// </summary>
        /// <param name="box">箱</param>
        /// <param name="pt">頂点の配列</param>
#else
        /// <summary>
        /// Finds box vertices
        /// </summary>
        /// <param name="box">Box</param>
        /// <param name="pt">Array of vertices</param>
#endif
        public static void BoxPoints(CvBox2D box, out CvPoint2D32f[] pt)
        {
            pt = new CvPoint2D32f[4];
            NativeMethods.cvBoxPoints(box, pt);

            // cvgeometry.cpp  line 89~103

            /*
             * double angle = box.Angle * CvConst.CV_PI / 180.0;
             * float a = (float)Math.Cos(angle)*0.5f;
             * float b = (float)Math.Sin(angle)*0.5f;
             *
             * pt[0].X = box.Center.X - a * box.Size.Height - b * box.Size.Width;
             * pt[0].Y = box.Center.Y + b * box.Size.Height - a * box.Size.Width;
             * pt[1].X = box.Center.X + a * box.Size.Height - b * box.Size.Width;
             * pt[1].Y = box.Center.Y - b * box.Size.Height - a * box.Size.Width;
             * pt[2].X = 2 * box.Center.X - pt[0].X;
             * pt[2].Y = 2 * box.Center.Y - pt[0].Y;
             * pt[3].X = 2 * box.Center.X - pt[1].X;
             * pt[3].Y = 2 * box.Center.Y - pt[1].Y;
             * //*/
        }
Esempio n. 3
0
/*#if LANG_JP
 *      /// <summary>
 *      /// 既定の初期化
 *      /// </summary>
 #else
 *      /// <summary>
 *      /// Default constructor
 *      /// </summary>
 #endif
 *      public CvBox2D()
 *      {
 *          Center = default(CvPoint2D32f);
 *          Size = default(CvSize2D32f);
 *          Angle = default(float);
 *      }*/
#if LANG_JP
        /// <summary>
        /// 初期化
        /// </summary>
        /// <param name="center">箱の中心</param>
        /// <param name="size">箱の幅と長さ</param>
        /// <param name="angle">水平軸と始めの辺(長さ方向の辺)との角度(度)</param>
#else
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="center"></param>
        /// <param name="size"></param>
        /// <param name="angle"></param>
#endif
        public CvBox2D(CvPoint2D32f center, CvSize2D32f size, float angle)
        {
            Center = center;
            Size   = size;
            Angle  = angle;
        }
Esempio n. 4
0
        /// <summary>
        /// 初期化
        /// </summary>
        /// <param name="center">円の中心</param>
        /// <param name="radius">半径</param>
#else
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="center">center</param>
        /// <param name="radius">radius</param>
#endif
        public CvCircleSegment(CvPoint2D32f center, float radius)
        {
            this.Center = center;
            this.Radius = radius;
        }
Esempio n. 5
0
        /// <summary>
        /// 指定した点と直線の距離を返す
        /// </summary>
        /// <param name="point"></param>
#else
        /// <summary>
        /// Returns the distance between this line and the specified point
        /// </summary>
        /// <param name="point"></param>
#endif
        public double Distance(CvPoint2D32f point)
        {
            return(Distance(point.X, point.Y));
        }
Esempio n. 6
0
        /// <summary>
        /// ドロネー三角形に点を追加する (cvSubdiv2DLocate).
        /// </summary>
        /// <param name="pt">配置する点</param>
        /// <param name="edge">出力される辺.配置した点は,その辺上または端に存在する.</param>
        /// <param name="vertex">オプション出力.入力点と一致する細分割の頂点へのポインタのポインタ</param>
        /// <returns>配置する点</returns>
#else
        /// <summary>
        /// Inserts a single point to Delaunay triangulation (cvSubdiv2DLocate).
        /// </summary>
        /// <param name="pt">The point to locate. </param>
        /// <param name="edge">The output edge the point falls onto or right to. </param>
        /// <param name="vertex">Optional output vertex double pointer the input point coinsides with. </param>
        /// <returns></returns>
#endif
        public CvSubdiv2DPointLocation Locate(CvPoint2D32f pt, out CvSubdiv2DEdge edge, ref CvSubdiv2DPoint vertex)
        {
            return(Cv.Subdiv2DLocate(this, pt, out edge, ref vertex));
        }
Esempio n. 7
0
        /// <summary>
        /// ドロネー三角形に点を追加する (cvSubdiv2DLocate).
        /// </summary>
        /// <param name="pt">配置する点</param>
        /// <param name="edge">出力される辺.配置した点は,その辺上または端に存在する.</param>
        /// <returns>配置する点</returns>
#else
        /// <summary>
        /// Inserts a single point to Delaunay triangulation (cvSubdiv2DLocate).
        /// </summary>
        /// <param name="pt">The point to locate. </param>
        /// <param name="edge">The output edge the point falls onto or right to. </param>
        /// <returns></returns>
#endif
        public CvSubdiv2DPointLocation Locate(CvPoint2D32f pt, out CvSubdiv2DEdge edge)
        {
            return(Cv.Subdiv2DLocate(this, pt, out edge));
        }
Esempio n. 8
0
        /// <summary>
        /// ドロネー三角形に点を追加する (cvSubdivDelaunay2D).
        /// </summary>
        /// <param name="pt">追加する点</param>
        /// <returns></returns>
#else
        /// <summary>
        /// Inserts a single point to Delaunay triangulation (cvSubdivDelaunay2D).
        /// </summary>
        /// <param name="pt">Inserted point. </param>
        /// <returns></returns>
#endif
        public CvSubdiv2DPoint Insert(CvPoint2D32f pt)
        {
            return(Cv.SubdivDelaunay2DInsert(this, pt));
        }
Esempio n. 9
0
        /// <summary>
        /// 与えられた点に最も近い細分割の頂点を求める. 入力点を細分割内に配置するもう一つの関数である.
        /// この関数は入力された点に最も近い頂点を求める.
        /// </summary>
        /// <param name="pt">入力点</param>
        /// <returns></returns>
#else
        /// <summary>
        /// Finds the closest subdivision vertex to given point
        /// </summary>
        /// <param name="pt">Input point. </param>
        /// <returns></returns>
#endif
        public CvSubdiv2DPoint FindNearestPoint2D(CvPoint2D32f pt)
        {
            return(Cv.FindNearestPoint2D(this, pt));
        }