10 Replies Latest reply on Jul 6, 2018 4:34 AM by PGTROBOTICS

    Video frame to bitmap

    VCS_5

      Hi,

       

      I'm now starting to use the d435 camera.

      I know how to convert a video frame to BitmapSource but is there any function to convert a video frame to bitmap on C#?

      If not how should I approach this? I tried by doing the follow but with no success.

      var bytes = new byte[frame.Stride * frame.Height];
                  frame.CopyTo(bytes);
                  Bitmap bmpRGB = null;
                  unsafe {
                      fixed (byte* ptr = bytes)
                      {
                          using (Bitmap image = new Bitmap(frame.Width, frame.Height, frame.Stride, System.Drawing.Imaging.PixelFormat.Format24bppRgb, new IntPtr(ptr)))
                          {
                              bmpRGB = image;
                              
                          }
                      }
                  }
                  return bmpRGB;
      

       

      Thanks,

      Vinicius