-
Notifications
You must be signed in to change notification settings - Fork 136
How to convert EmguCV.Mat to?
Takuya Takeuchi edited this page Jun 1, 2019
·
6 revisions
using (var mat = CvInvoke.Imread("Lenna.png", ImreadModes.AnyColor))
{
var array = new byte[mat.Width * mat.Height * mat.ElementSize];
mat.CopyTo(array);
// TODO: support BGR image
using (var image = new DlibDotNet.Matrix<RgbPixel>(array, mat.Height, mat.Width, mat.ElementSize))
{
// something to do
}
}
https://github.com/takuya-takeuchi/DlibDotNet/tree/master/examples/3rdparty/EmguCV/MatToMatrix
using (var mat = CvInvoke.Imread("Lenna.png", ImreadModes.AnyColor))
{
var array = new byte[mat.Width * mat.Height * mat.ElementSize];
mat.CopyTo(array);
using (var image = Dlib.LoadImageData<RgbPixel>(array, (uint)mat.Height, (uint)mat.Width, (uint)(mat.Width * mat.ElementSize)))
{
// something to do
}
}
https://github.com/takuya-takeuchi/DlibDotNet/tree/master/examples/3rdparty/EmguCV/MatToArray2D