Exemplo n.º 1
0
        public static unsafe void ToMat(this IImage input, Mat dstMat)
        {
            var info = input.Info;
            var type = info.Format.ToMatType(info.OriginalFormat);

            using (var srcData = input.GetData())
            {
                dstMat.Create(info.Height, info.Width, type);
                ImageExtensions.CopyTo(srcData, info, (byte *)dstMat.Data.ToPointer());
            }
        }
Exemplo n.º 2
0
        public static void ToMat(this IImage input, Mat dstMat)
        {
            var info = input.Info;
            var type = info.Format.ToMatType(info.OriginalFormat);

            dstMat.Create(info.Height, info.Width, type);
            using (var srcData = input.GetData())
                using (var dstData = new MatImage.Data(dstMat))
                {
                    ImageExtensions.CopyTo(srcData, dstData);
                }
        }
Exemplo n.º 3
0
        public static unsafe Mat ToMat(this IImage input)
        {
            var info = input.Info;
            var type = info.Format.ToMatType(info.OriginalFormat);

            using (var srcData = input.GetData())
            {
                var dstData = new byte[srcData.Size];

                fixed(byte *dst = dstData)
                ImageExtensions.CopyTo(srcData, info, dst);

                return(new Mat(info.Height, info.Width, type, dstData, srcData.ScanSize));
            }
        }