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()); } }
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); } }
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)); } }