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

private cvMinAreaRect2 ( IntPtr points, IntPtr storage ) : MCvBox2D
points IntPtr
storage IntPtr
Результат MCvBox2D
Пример #1
0
        /// <summary>
        /// Find the bounding rectangle for the specific array of points
        /// </summary>
        /// <param name="points">The collection of points</param>
        /// <returns>The bounding rectangle for the array of points</returns>
        public static MCvBox2D MinAreaRect(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);
            MCvBox2D rect = CvInvoke.cvMinAreaRect2(seq, IntPtr.Zero);

            handle.Free();
            Marshal.FreeHGlobal(seq);
            Marshal.FreeHGlobal(block);
            return(rect);
        }
Пример #2
0
 /// <summary>
 /// Get the minimum area rectangle for this point sequence
 /// </summary>
 /// <param name="stor">The temporary storage to use</param>
 /// <returns>The minimum area rectangle</returns>
 public MCvBox2D GetMinAreaRect(MemStorage stor)
 {
     return(CvInvoke.cvMinAreaRect2(Ptr, stor == null ? IntPtr.Zero : stor.Ptr));
 }