当前位置: 首页>>代码示例>>C#>>正文


C# Seq.InContour方法代码示例

本文整理汇总了C#中Seq.InContour方法的典型用法代码示例。如果您正苦于以下问题:C# Seq.InContour方法的具体用法?C# Seq.InContour怎么用?C# Seq.InContour使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Seq的用法示例。


在下文中一共展示了Seq.InContour方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: insertPoints

        /// <summary>
        /// Inserts numP points into the polygon
        /// </summary>
        /// <param name="poly">Eequence of points representing the polygon border</param>
        /// <param name="numP">Number of points to insert</param>
        void insertPoints(ref Seq<Point> poly, ref PolyFromTris triPoly, int numP, int iw, int ih)
        {
            ///////////////////////////////////////////// TODO: FIX !!!!!!
            Seq<PointF> testsek = new Seq<PointF>(new MemStorage());

            foreach (Point p in poly)
            {
                testsek.Insert(testsek.Total, new PointF((float)p.X, (float)p.Y));
            }

            Rectangle rect = testsek.BoundingRectangle;
            ////////////////////////////////////////


            //
            // Calculate BoundingBox to narrow random-inserting points area
          //  Rectangle rect = poly.BoundingRectangle;

            int maxIter = numP*500;

            while (numP > 0) // We want inside numP random points
            {
                if (maxIter-- <= 0) break;

                // Generate point inside BBox
                Point p = new Point(random.Next(rect.X, rect.X + rect.Width), random.Next(rect.Y, rect.Y+rect.Height));

                if (p.X > iw || p.Y > ih || p.Y < 0 || p.X<0) continue;

                if (poly.InContour(p) > 0) // If point is on the poly
                {

                    triPoly.addInnerPoint(new PointF((float)p.X, (float)p.Y));
                    poly.Insert(poly.Total, p); // Insert it to our list
                    numP--;
                }
 
            } 
        }
开发者ID:aljosaosep,项目名称:holdrecognition,代码行数:44,代码来源:HoldTriangulation.cs

示例2: TestConvexityDefacts

        public void TestConvexityDefacts()
        {
            Image<Gray, Byte> image = new Image<Gray, byte>(300, 300);
             Point[] polyline = new Point[] {
            new Point(10, 10),
            new Point(10, 250),
            new Point(100, 100),
            new Point(250, 250),
            new Point(250, 10)};

             using (MemStorage stor = new MemStorage())
             {
            Seq<Point> contour = new Seq<Point>(stor);
            contour.PushMulti(polyline, Emgu.CV.CvEnum.BACK_OR_FRONT.FRONT);
            image.Draw(contour, new Gray(255), 1);
            Seq<MCvConvexityDefect> defactSeq =
               contour.GetConvexityDefacts(
                  stor,
                  Emgu.CV.CvEnum.ORIENTATION.CV_CLOCKWISE);
            MCvConvexityDefect[] defacts = defactSeq.ToArray();
            Assert.AreEqual(1, defacts.Length);
            Assert.AreEqual(new Point(100, 100), defacts[0].DepthPoint);

            Assert.IsTrue(contour.InContour(new PointF(90, 90)) > 0);
            Assert.IsTrue(contour.InContour(new PointF(300, 300)) < 0);
            Assert.IsTrue(contour.InContour(new PointF(10, 10)) == 0);
             }
        }
开发者ID:samuto,项目名称:UnityOpenCV,代码行数:28,代码来源:AutoTestVarious.cs

示例3: IsPlayerPixel

 bool IsPlayerPixel(Seq<Point> contour, Byte[, ,] skinMask, int x, int y, int depth)
 {
     return contour.InContour(new Point(x, y)) >= 0 &&
      (skinMask == null || skinMask[y, x, 0] > 0) &&
      depth > HandInputParams.MinDepth;
 }
开发者ID:ushadow,项目名称:handinput,代码行数:6,代码来源:PlayerDetector.cs


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