private cvConvexHull2 ( IntPtr input, IntPtr hullStorage, CvEnum orientation, int returnPoints ) : IntPtr | ||
input | IntPtr | |
hullStorage | IntPtr | |
orientation | CvEnum | |
returnPoints | int | |
return | IntPtr |
/// <summary> /// Finds all convexity defects of the input contour and returns a sequence of the CvConvexityDefect structures. /// </summary> /// <param name="storage">Container for output sequence of convexity defects. If it is NULL, contour or hull (in that order) storage is used.</param> /// <param name="orientation">Orientation where the convexity Defacts is returned.</param> /// <returns>The sequence of the CvConvexityDefect structures.</returns> public Seq <MCvConvexityDefect> GetConvexityDefacts(MemStorage storage, Emgu.CV.CvEnum.ORIENTATION orientation) { MemStorage stor = storage ?? Storage; IntPtr convexHull = CvInvoke.cvConvexHull2(Ptr, stor, orientation, 0); IntPtr seq = CvInvoke.cvConvexityDefects(Ptr, convexHull, stor); return(new Seq <MCvConvexityDefect>(seq, stor)); }
/// <summary> /// Finds convex hull of 2D point set using Sklansky's algorithm /// </summary> /// <param name="points">The points to find convex hull from</param> /// <param name="storage">the storage used by the resulting sequence</param> /// <param name="orientation">The orientation of the convex hull</param> /// <returns>The convex hull of the points</returns> public static Seq <PointF> ConvexHull(PointF[] points, MemStorage storage, CvEnum.ORIENTATION orientation) { IntPtr seq = Marshal.AllocHGlobal(StructSize.MCvSeq); IntPtr block = Marshal.AllocHGlobal(StructSize.MCvSeqBlock); GCHandle handle = GCHandle.Alloc(points, GCHandleType.Pinned); CvInvoke.cvMakeSeqHeaderForArray( CvInvoke.CV_MAKETYPE((int)CvEnum.MAT_DEPTH.CV_32F, 2), StructSize.MCvSeq, StructSize.PointF, handle.AddrOfPinnedObject(), points.Length, seq, block); Seq <PointF> convexHull = new Seq <PointF>(CvInvoke.cvConvexHull2(seq, storage.Ptr, orientation, 1), storage); handle.Free(); Marshal.FreeHGlobal(seq); Marshal.FreeHGlobal(block); return(convexHull); }
/// <summary> /// Get the convex hull of this point sequence /// </summary> /// <param name="orientation">The orientation of the convex hull</param> /// <param name="stor">The storage for the resulting sequence</param> /// <returns>The result convex hull</returns> public Seq <T> GetConvexHull(CvEnum.ORIENTATION orientation, MemStorage stor) { IntPtr hull = CvInvoke.cvConvexHull2(Ptr, stor, orientation, 1); return(new Seq <T>(hull, stor)); }