Convert Texture2D to Image emgu CV - fast way

Hi all,

I’m trying to convert a texture2D to an emgu CV Image. I want a fast way to do it, without access each pixel individually (for loop). I’m trying to use Marshal.copy or some memory access.

If I know how color32 are place in memory it would be great.

Thanks in advance.

try with Sprite.Create() method

I’m doing something like this:

Image<Bgr, byte> output;

MemoryStream m = new MemoryStream(input.EncodeToPNG());
Image<Rgba, byte> temp = new Image<Rgba, byte>(input.width, input.height);

temp.Bitmap = new Bitmap(m);

output = temp.Convert<Bgr, byte>();

Hope this helps.