Items with no label
3335 Discussions

D435: Convert Videoframe to Bitmap in C#

idata
Employee
2,904 Views

Hello,

i am looking for the fastest conversion of a Videoframe to a Bitmap.

Currently i am doing this:

Bitmap bmp = new Bitmap(frame.Width, frame.Height, frame.Stride, System.Drawing.Imaging.Pixelformat.Format24bppRgb, frame.Data);

Afterwards i am doing a face detection and recognition with the Bitmap and display it through a System.Windows.Controls.Image.

Using a regular Webcam or the R200 works smooth, but the output is laggy when i am using the D435.

Any ideas?

0 Kudos
3 Replies
MartyG
Honored Contributor III
1,412 Views

RealSense SDK 2.0 has a sample program for saving a frame to disk as a PNG image.

https://github.com/IntelRealSense/librealsense/tree/master/examples/save-to-disk librealsense/examples/save-to-disk at master · IntelRealSense/librealsense · GitHub

Edit: I re-read and saw that you need the code in C# . I do not have a C# sample for saving frames as images, unfortunately.

0 Kudos
idata
Employee
1,412 Views

Hey MartyG,

i edited it afterwards, so that was my mistake missing the c# part.

 

Edit: in case you did read my second question, i picked the wrong format, i fixed that now

0 Kudos
MartyG
Honored Contributor III
1,412 Views

Thanks Niko.

If you are doing the conversion of the frame to bitmap just for the purposes of feeding it into your face detection routine, you may be interested in new skeletal tracking software for the D415 and D435 called Nuitrack that can do full-body tracking and face recognition.

https://www.youtube.com/watch?v=gMPtV4NXtUo Intel RealSense D415/D435 and Nuitrack skeletal tracking SDK replace Kinect SDK - YouTube

0 Kudos
Reply