• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# Point2f类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Point2f的典型用法代码示例。如果您正苦于以下问题:C# Point2f类的具体用法?C# Point2f怎么用?C# Point2f使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Point2f类属于命名空间,在下文中一共展示了Point2f类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: mapToSphere

    public void mapToSphere(Point point, Vector3f vector)
    {
        //Copy paramter into temp point
        Point2f tempPoint = new Point2f(point.X, point.Y);

        //Adjust point coords and scale down to range of [-1 ... 1]
        tempPoint.x = (tempPoint.x * this.adjustWidth) - 1.0f;
        tempPoint.y = 1.0f - (tempPoint.y * this.adjustHeight);

        //Compute the square of the length of the vector to the point from the center
        float length = (tempPoint.x * tempPoint.x) + (tempPoint.y * tempPoint.y);

        //If the point is mapped outside of the sphere... (length > radius squared)
        if (length > 1.0f)
        {
            //Compute a normalizing factor (radius / sqrt(length))
            float norm = (float) (1.0 / Math.Sqrt(length));

            //Return the "normalized" vector, a point on the sphere
            vector.x = tempPoint.x * norm;
            vector.y = tempPoint.y * norm;
            vector.z = 0.0f;
        }
        else    //Else it's on the inside
        {
            //Return a vector to a point mapped inside the sphere sqrt(radius squared - length)
            vector.x = tempPoint.x;
            vector.y = tempPoint.y;
            vector.z = (float) Math.Sqrt(1.0f - length);
        }
    }
开发者ID:jesantana,项目名称:RSAGenerator,代码行数:31,代码来源:ArcBall.cs


示例2: Line

 public Line(Graphics gs, Pen pen, Point2f x, Point2f y)
     : base(gs)
 {
     this.pen = pen;
     this.b = x;
     this.e = y;
 }
开发者ID:TheProjecter,项目名称:somscode,代码行数:7,代码来源:Line.cs


示例3: DrawSpot

        public void DrawSpot(Point2f spot)
        {
            using (var graphics = Graphics.FromImage(streamBox.Image))
            {
                graphics.DrawEllipse(Pens.CornflowerBlue, spot.X - 2, spot.Y - 2, 4, 4);

                //streamBox.Image = new Bitmap(bitmap, streamBox.Size);
            }
        }
开发者ID:mmcs-robotics,项目名称:mapping_2015,代码行数:9,代码来源:MainForm.cs


示例4: Run

        public void Run()
        {

            Console.WriteLine("===== FlannTest =====");

            // creates data set
            using (Mat features = new Mat(10000, 2, MatType.CV_32FC1))
            {
                Random rand = new Random();
                for (int i = 0; i < features.Rows; i++)
                {
                    features.Set<float>(i, 0, rand.Next(10000));
                    features.Set<float>(i, 1, rand.Next(10000));
                }

                // query
                Point2f queryPoint = new Point2f(7777, 7777);
                Mat queries = new Mat(1, 2, MatType.CV_32FC1);
                queries.Set<float>(0, 0, queryPoint.X);
                queries.Set<float>(0, 1, queryPoint.Y);
                Console.WriteLine("query:({0}, {1})", queryPoint.X, queryPoint.Y);
                Console.WriteLine("-----");

                // knnSearch
                using (Index nnIndex = new Index(features, new KDTreeIndexParams(4)))
                {
                    const int Knn = 1;
                    int[] indices;
                    float[] dists;
                    nnIndex.KnnSearch(queries, out indices, out dists, Knn, new SearchParams(32));

                    for (int i = 0; i < Knn; i++)
                    {
                        int index = indices[i];
                        float dist = dists[i];
                        Point2f pt = new Point2f(features.Get<float>(index, 0), features.Get<float>(index, 1));
                        Console.Write("No.{0}\t", i);
                        Console.Write("index:{0}", index);
                        Console.Write(" distance:{0}", dist);
                        Console.Write(" data:({0}, {1})", pt.X, pt.Y);
                        Console.WriteLine();
                    }
                    Knn.ToString();
                }
            }
            Console.Read();
        }
开发者ID:jorik041,项目名称:opencvsharp,代码行数:47,代码来源:FlannSample.cs


示例5: Points

        /// <summary>
        /// returns 4 vertices of the rectangle
        /// </summary>
        /// <returns></returns>
        public Point2f[] Points()
        {
            double angle = Angle * Cv.PI / 180.0;
            float b = (float)Math.Cos(angle) * 0.5f;
            float a = (float)Math.Sin(angle) * 0.5f;

            Point2f[] pt = new Point2f[4];
            pt[0].X = Center.X - a * Size.Height - b * Size.Width;
            pt[0].Y = Center.Y + b * Size.Height - a * Size.Width;
            pt[1].X = Center.X + a * Size.Height - b * Size.Width;
            pt[1].Y = Center.Y - b * Size.Height - a * Size.Width;
            pt[2].X = 2 * Center.X - pt[0].X;
            pt[2].Y = 2 * Center.Y - pt[0].Y;
            pt[3].X = 2 * Center.X - pt[1].X;
            pt[3].Y = 2 * Center.Y - pt[1].Y;
            return pt;
        }
开发者ID:0sv,项目名称:opencvsharp,代码行数:21,代码来源:RotatedRect.cs


示例6: SaveCallibration

        public void SaveCallibration(string path, Point2f[] src, Point2f[] dst)
        {
            this.srcx = new List<float>();
            this.srcy = new List<float>();
            this.dstx = new List<float>();
            this.dsty = new List<float>();

            foreach (var p in src)
            {
                this.srcx.Add(p.X);
                this.srcy.Add(p.Y);
            }
            foreach (var q in dst)
            {
                this.dstx.Add(q.X);
                this.dsty.Add(q.Y);
            }
            this.Save(path);
        }
开发者ID:0tsukq,项目名称:LabLife,代码行数:19,代码来源:CallibrationData.cs


示例7: LoadCallibration

        public void LoadCallibration(string path, Point2f[] src, Point2f[] dst)
        {
            this.Load(path);

            src[0].X = srcx[0];
            src[1].X = srcx[1];
            src[2].X = srcx[2];
            src[3].X = srcx[3];
            src[0].Y = srcy[0];
            src[1].Y = srcy[1];
            src[2].Y = srcy[2];
            src[3].Y = srcy[3];

            dst[0].X = dstx[0];
            dst[1].X = dstx[1];
            dst[2].X = dstx[2];
            dst[3].X = dstx[3];
            dst[0].Y = dsty[0];
            dst[1].Y = dsty[1];
            dst[2].Y = dsty[2];
            dst[3].Y = dsty[3];
        }
开发者ID:0tsukq,项目名称:LabLife,代码行数:22,代码来源:CallibrationData.cs


示例8: MinEnclosingCircle

 /// <summary>
 /// Finds the minimum area circle enclosing a 2D point set.
 /// The input is 2D point set, represented by CV_32SC2 or CV_32FC2 matrix.
 /// </summary>
 /// <param name="center">The output center of the circle</param>
 /// <param name="radius">The output radius of the circle</param>
 public void MinEnclosingCircle(out Point2f center, out float radius)
 {
     Cv2.MinEnclosingCircle(this, out center, out radius);
 }
开发者ID:MJunak,项目名称:opencvsharp,代码行数:10,代码来源:Mat_CvMethods.cs


示例9: ON_Mesh_SetTextureCoordinates

 internal static extern bool ON_Mesh_SetTextureCoordinates(IntPtr pMesh, int count, ref Point2f tcs, [MarshalAs(UnmanagedType.U1)]bool append);
开发者ID:kalvo,项目名称:rhinocommon,代码行数:1,代码来源:AutoNativeMethods.cs


示例10: FindCirclesGrid

        /// <summary>
        /// Finds centers in the grid of circles.
        /// </summary>
        /// <param name="image">grid view of input circles; it must be an 8-bit grayscale or color image.</param>
        /// <param name="patternSize">number of circles per row and column ( patternSize = Size(points_per_row, points_per_colum) ).</param>
        /// <param name="centers">output array of detected centers.</param>
        /// <param name="flags">various operation flags that can be one of the FindCirclesGridFlag values</param>
        /// <param name="blobDetector">feature detector that finds blobs like dark circles on light background.</param>
        /// <returns></returns>
        public static bool FindCirclesGrid(
            InputArray image,
            Size patternSize,
            out Point2f[] centers,
            FindCirclesGridFlag flags = FindCirclesGridFlag.SymmetricGrid,
            FeatureDetector blobDetector = null)
        {
            if (image == null)
                throw new ArgumentNullException("image");
            image.ThrowIfDisposed();

            using (var centersVec = new VectorOfPoint2f())
            {
                int ret = NativeMethods.calib3d_findCirclesGrid_InputArray(
                image.CvPtr, patternSize, centersVec.CvPtr, (int)flags, ToPtr(blobDetector));
                centers = centersVec.ToArray();
                return ret != 0;
            }
        }
开发者ID:kaorun55,项目名称:opencvsharp,代码行数:28,代码来源:Cv2_calib3d.cs


示例11: GetVoronoiFacetList

        /// <summary>
        /// 
        /// </summary>
        /// <param name="idx"></param>
        /// <param name="facetList"></param>
        /// <param name="facetCenters"></param>
        public void GetVoronoiFacetList(IEnumerable<int> idx, out Point2f[][] facetList, out Point2f[] facetCenters)
        {
            if (disposed)
                throw new ObjectDisposedException("Subdiv2D", "");

            IntPtr facetListPtr, facetCentersPtr;
            if (idx == null)
            {
                NativeMethods.imgproc_Subdiv2D_getVoronoiFacetList(ptr, IntPtr.Zero, 0, out facetListPtr, out facetCentersPtr);
            }
            else
            {
                int[] idxArray = EnumerableEx.ToArray(idx);
                NativeMethods.imgproc_Subdiv2D_getVoronoiFacetList(ptr, idxArray, idxArray.Length, out facetListPtr, out facetCentersPtr);
            }

            using (VectorOfVectorPoint2f facetListVec = new VectorOfVectorPoint2f(facetListPtr))
            {
                facetList = facetListVec.ToArray();
            }
            using (VectorOfPoint2f facetCentersVec = new VectorOfPoint2f(facetCentersPtr))
            {
                facetCenters = facetCentersVec.ToArray();
            }
        }
开发者ID:0sv,项目名称:opencvsharp,代码行数:31,代码来源:Subdiv2D.cs


示例12: FindNearest

 /// <summary>
 /// 
 /// </summary>
 /// <param name="pt"></param>
 /// <returns></returns>
 public int FindNearest(Point2f pt)
 {
     Point2f nearestPt;
     return FindNearest(pt, out nearestPt);
 }
开发者ID:0sv,项目名称:opencvsharp,代码行数:10,代码来源:Subdiv2D.cs


示例13: Insert

 /// <summary>
 /// 
 /// </summary>
 /// <param name="ptvec"></param>
 public void Insert(Point2f[] ptvec)
 {
     if(disposed)
         throw new ObjectDisposedException("Subdiv2D", "");
     if(ptvec == null)
         throw new ArgumentNullException("ptvec");
     NativeMethods.imgproc_Subdiv2D_insert(ptr, ptvec, ptvec.Length);
 }
开发者ID:0sv,项目名称:opencvsharp,代码行数:12,代码来源:Subdiv2D.cs


示例14: CalcOpticalFlowPyrLK

        /// <summary>
        /// computes sparse optical flow using multi-scale Lucas-Kanade algorithm
        /// </summary>
        /// <param name="prevImg"></param>
        /// <param name="nextImg"></param>
        /// <param name="prevPts"></param>
        /// <param name="nextPts"></param>
        /// <param name="status"></param>
        /// <param name="err"></param>
        /// <param name="winSize"></param>
        /// <param name="maxLevel"></param>
        /// <param name="criteria"></param>
        /// <param name="flags"></param>
        /// <param name="minEigThreshold"></param>
        public static void CalcOpticalFlowPyrLK(
            InputArray prevImg, InputArray nextImg,
            Point2f[] prevPts, ref Point2f[] nextPts,
            out byte[] status, out float[] err,
            Size? winSize = null,
            int maxLevel = 3,
            TermCriteria? criteria = null,
            OpticalFlowFlags flags = OpticalFlowFlags.None,
            double minEigThreshold = 1e-4)
        {
            if (prevImg == null)
                throw new ArgumentNullException("prevImg");
            if (nextImg == null)
                throw new ArgumentNullException("nextImg");
            if (prevPts == null)
                throw new ArgumentNullException("prevPts");
            if (nextPts == null)
                throw new ArgumentNullException("nextPts");
            prevImg.ThrowIfDisposed();
            nextImg.ThrowIfDisposed();

            Size winSize0 = winSize.GetValueOrDefault(new Size(21, 21));
            TermCriteria criteria0 = criteria.GetValueOrDefault(
                TermCriteria.Both(30, 0.01));

            using (var nextPtsVec = new VectorOfPoint2f())
            using (var statusVec = new VectorOfByte())
            using (var errVec = new VectorOfFloat())
            {
                NativeMethods.video_calcOpticalFlowPyrLK_vector(
                    prevImg.CvPtr, nextImg.CvPtr, prevPts, prevPts.Length,
                    nextPtsVec.CvPtr, statusVec.CvPtr, errVec.CvPtr, 
                    winSize0, maxLevel, criteria0, (int)flags, minEigThreshold);
                nextPts = nextPtsVec.ToArray();
                status = statusVec.ToArray();
                err = errVec.ToArray();
            }
        }
开发者ID:healtech,项目名称:opencvsharp,代码行数:52,代码来源:Cv2_video.cs


示例15: video_calcOpticalFlowPyrLK_vector

 public static extern void video_calcOpticalFlowPyrLK_vector(
     IntPtr prevImg, IntPtr nextImg,
     Point2f[] prevPts, int prevPtsSize,
     IntPtr nextPts, IntPtr status, IntPtr err,
     Size winSize, int maxLevel, TermCriteria criteria,
     int flags, double minEigThreshold);
开发者ID:JiphuTzu,项目名称:opencvsharp,代码行数:6,代码来源:NativeMethods_video.cs


示例16: CornerSubPix

        /// <summary>
        /// adjusts the corner locations with sub-pixel accuracy to maximize the certain cornerness criteria
        /// </summary>
        /// <param name="image">Input image.</param>
        /// <param name="inputCorners">Initial coordinates of the input corners and refined coordinates provided for output.</param>
        /// <param name="winSize">Half of the side length of the search window.</param>
        /// <param name="zeroZone">Half of the size of the dead region in the middle of the search zone 
        /// over which the summation in the formula below is not done. It is used sometimes to avoid possible singularities 
        /// of the autocorrelation matrix. The value of (-1,-1) indicates that there is no such a size.</param>
        /// <param name="criteria">Criteria for termination of the iterative process of corner refinement. 
        /// That is, the process of corner position refinement stops either after criteria.maxCount iterations 
        /// or when the corner position moves by less than criteria.epsilon on some iteration.</param>
        /// <returns></returns>
        public static Point2f[] CornerSubPix(InputArray image, IEnumerable<Point2f> inputCorners,
            Size winSize, Size zeroZone, CvTermCriteria criteria)
        {
            if (image == null)
                throw new ArgumentNullException("image");
            if (inputCorners == null)
                throw new ArgumentNullException("inputCorners");
            image.ThrowIfDisposed();

            var inputCornersSrc = Util.ToArray(inputCorners);
            var inputCornersCopy = new Point2f[inputCornersSrc.Length];
            Array.Copy(inputCornersSrc, inputCornersCopy, inputCornersSrc.Length);
            using (var vector = new VectorOfPoint2f(inputCornersCopy))
            {
                NativeMethods.imgproc_cornerSubPix(image.CvPtr, vector.CvPtr, winSize, zeroZone, criteria);
                return vector.ToArray();
            }
        }
开发者ID:josephgodwinkimani,项目名称:opencvsharp,代码行数:31,代码来源:Cv2_imgproc.cs


示例17: GetRotationMatrix2D

        /// <summary>
        /// 
        /// </summary>
        /// <param name="center"></param>
        /// <param name="angle"></param>
        /// <param name="scale"></param>
        /// <returns></returns>
        public static Mat GetRotationMatrix2D(Point2f center, double angle, double scale)
        {
            IntPtr ret = NativeMethods.imgproc_getRotationMatrix2D(center, angle, scale);
            return new Mat(ret);

        }
开发者ID:josephgodwinkimani,项目名称:opencvsharp,代码行数:13,代码来源:Cv2_imgproc.cs


示例18: Locate

 /// <summary>
 /// 
 /// </summary>
 /// <param name="pt"></param>
 /// <param name="edge"></param>
 /// <param name="vertex"></param>
 /// <returns></returns>
 public int Locate(Point2f pt, out int edge, out int vertex)
 {
     if (disposed)
         throw new ObjectDisposedException("Subdiv2D", "");
     return NativeMethods.imgproc_Subdiv2D_locate(ptr, pt, out edge, out vertex);
 }
开发者ID:0sv,项目名称:opencvsharp,代码行数:13,代码来源:Subdiv2D.cs


示例19: GetRectSubPix

 /// <summary>
 /// Retrieves a pixel rectangle from an image with sub-pixel accuracy.
 /// </summary>
 /// <param name="image">Source image.</param>
 /// <param name="patchSize">Size of the extracted patch.</param>
 /// <param name="center">Floating point coordinates of the center of the extracted rectangle 
 /// within the source image. The center must be inside the image.</param>
 /// <param name="patch">Extracted patch that has the size patchSize and the same number of channels as src .</param>
 /// <param name="patchType">Depth of the extracted pixels. By default, they have the same depth as src.</param>
 public static void GetRectSubPix(InputArray image, Size patchSize, Point2f center, 
     OutputArray patch, int patchType = -1)
 {
     if (image == null)
         throw new ArgumentNullException("image");
     if (patch == null)
         throw new ArgumentNullException("patch");
     image.ThrowIfDisposed();
     patch.ThrowIfNotReady();
     NativeMethods.imgproc_getRectSubPix(image.CvPtr, patchSize, center, patch.CvPtr, patchType);
     patch.Fix();
 }
开发者ID:josephgodwinkimani,项目名称:opencvsharp,代码行数:21,代码来源:Cv2_imgproc.cs


示例20: MinEnclosingCircle

 /// <summary>
 /// Finds the minimum area circle enclosing a 2D point set.
 /// </summary>
 /// <param name="points">The input 2D point set, represented by CV_32SC2 or CV_32FC2 matrix.</param>
 /// <param name="center">The output center of the circle</param>
 /// <param name="radius">The output radius of the circle</param>
 public static void MinEnclosingCircle(InputArray points, out Point2f center, out float radius)
 {
     if (points == null)
         throw new ArgumentNullException("points");
     points.ThrowIfDisposed();
     NativeMethods.imgproc_minEnclosingCircle_InputArray(points.CvPtr, out center, out radius);
 }
开发者ID:josephgodwinkimani,项目名称:opencvsharp,代码行数:13,代码来源:Cv2_imgproc.cs



注:本文中的Point2f类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Point3类代码示例发布时间:2022-05-24
下一篇:
C# Point2d类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap