Emgu.CV.CvInvoke.cvMinEnclosingCircle C# (CSharp) Метод

cvMinEnclosingCircle() приватный Метод

private cvMinEnclosingCircle ( IntPtr points, PointF &center, float &radius ) : bool
points IntPtr
center PointF
radius float
Результат bool
        public static extern bool cvMinEnclosingCircle(IntPtr points, out PointF center, out float radius);

Usage Example

Пример #1
0
        /// <summary>
        /// Find the minimum enclosing circle for the specific array of points
        /// </summary>
        /// <param name="points">The collection of points</param>
        /// <returns>The minimum enclosing circle for the array of points</returns>
        public static CircleF MinEnclosingCircle(PointF[] points)
        {
            IntPtr   seq    = Marshal.AllocHGlobal(StructSize.MCvContour);
            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);
            PointF center;
            float  radius;

            CvInvoke.cvMinEnclosingCircle(seq, out center, out radius);
            handle.Free();
            Marshal.FreeHGlobal(seq);
            Marshal.FreeHGlobal(block);
            return(new CircleF(center, radius));
        }
CvInvoke