You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello, all. I am hoping to use ImageSharp to replace the .NET Bitmap in my NDI application. Currently, the NDI videoframe is updated by passing the nint buffer to the .NET Bitmap's constructor and then modifying the Bitmap/Graphic instance as required.
_bitmap = new Bitmap(_videoFrame.Width, _videoFrame.Height, _videoFrame.Stride, System.Drawing.Imaging.PixelFormat.Format32bppPArgb, _videoFrame.BufferPtr);
I am able to save the Image instance to a memorystream/byte array and then import the data into a .NET Bitmap and draw it on the videoframe's graphic, but that solution won't scale well when I start sending a 30fps video stream.
using MemoryStream ms = new();
imageIn.Save(ms, fmt);
ms.Position = 0;
return new Bitmap(ms);
I attempted to eliminate the .NET Bitmap step by writing the Image's data to the nint buffer directly, but the videoframe doesn't change and no exceptions are thrown.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Hello, all. I am hoping to use ImageSharp to replace the .NET Bitmap in my NDI application. Currently, the NDI videoframe is updated by passing the nint buffer to the .NET Bitmap's constructor and then modifying the Bitmap/Graphic instance as required.
_bitmap = new Bitmap(_videoFrame.Width, _videoFrame.Height, _videoFrame.Stride, System.Drawing.Imaging.PixelFormat.Format32bppPArgb, _videoFrame.BufferPtr);
I am able to save the Image instance to a memorystream/byte array and then import the data into a .NET Bitmap and draw it on the videoframe's graphic, but that solution won't scale well when I start sending a 30fps video stream.
I attempted to eliminate the .NET Bitmap step by writing the Image's data to the nint buffer directly, but the videoframe doesn't change and no exceptions are thrown.
Marshal.Copy(imageData, 0, frame.BufferPtr, imageData.Length);
I don't have much experience with unmanaged resources, so any advice would be greatly appreciated. Thanks.
Beta Was this translation helpful? Give feedback.
All reactions