Emgu.CV.CvInvoke.cvCalcSubdivVoronoi2D C# (CSharp) Method

cvCalcSubdivVoronoi2D() private method

private cvCalcSubdivVoronoi2D ( IntPtr subdiv ) : void
subdiv IntPtr
return void
        public static extern void cvCalcSubdivVoronoi2D(IntPtr subdiv);

Usage Example

コード例 #1
0
        /// <summary>
        /// Obtains the list of Voronoi Facets
        /// </summary>
        /// <returns>The list of Voronoi Facets</returns>
        private IEnumerable <VoronoiFacet> GetVoronoiFacetsHelper()
        {
            if (_isVoronoiDirty)
            {
                CvInvoke.cvCalcSubdivVoronoi2D(Ptr);
                _isVoronoiDirty = false;
            }

            int size = MCvSubdiv2D.total;

            PointF[]          points      = new PointF[size];
            MCvSubdiv2DEdge[] edges       = new MCvSubdiv2DEdge[size];
            GCHandle          pointHandle = GCHandle.Alloc(points, GCHandleType.Pinned);
            GCHandle          edgeHandle  = GCHandle.Alloc(edges, GCHandleType.Pinned);

            CvInvoke.PlanarSubdivisionGetSubdiv2DPoints(_ptr, pointHandle.AddrOfPinnedObject(), edgeHandle.AddrOfPinnedObject(), ref size);
            pointHandle.Free();
            edgeHandle.Free();
            using (MemStorage stor = new MemStorage())
            {
                Seq <PointF> ptSeq = new Seq <PointF>(stor);
                for (int i = 0; i < size; i++)
                {
                    CvInvoke.PlanarSubdivisionEdgeToPoly(edges[i], ptSeq);
                    PointF[] polygon = ptSeq.ToArray();
                    if (polygon.Length > 0)
                    {
                        yield return(new VoronoiFacet(points[i], polygon));
                    }
                }
            }
        }
All Usage Examples Of Emgu.CV.CvInvoke::cvCalcSubdivVoronoi2D
CvInvoke