Exemple #1
0
        internal static IntPtr cvStringCreateFromStr(string source)
        {
            byte[] array = Encoding.UTF8.GetBytes(source);
            Array.Resize(ref array, array.Length + 1);

            IntPtr result = IntPtr.Zero;

            using (DisposableHandle arrayHandle = DisposableHandle.Alloc(array))
            {
                result = cveStringCreateFromStr(arrayHandle.Pointer);
            }

            return(result);
        }
        public static PointF[] BoxPoints(RotatedRect box)
        {
            PointF[] pointsArray = new PointF[4];

            using (DisposableHandle arrayHandle = DisposableHandle.Alloc(pointsArray))
            {
                using (Mat arrayMat = new Mat(4, 2, DepthType.Cv32F, 1, arrayHandle, 8))
                {
                    using (OutputArray outArray = arrayMat.GetOutputArray())
                    {
                        cveBoxPoints(ref box, outArray);
                    }
                }
            }

            return(pointsArray);
        }