Items with no label
公告
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.

D435 camera

KLi21
初学者
4,050 次查看

Hi,

Just a couple of basic questions on Realsense D435 camera:

1. Is the camera supported in both RealSense SDK for Linux as well as the Librealsense SDK?

2. What is the best and quickest way to convert the frames captured and convert to mpeg format video?

Thanks.

0 项奖励
9 回复数
MartyG
名誉分销商 III
1,680 次查看

1. The D435 camera uses the new RealSense SDK 2.0, which is an advanced form of Librealsense and is a cross-platform SDK that can be used with Windows, Linux and Mac OS High Sierra. The RealSense SDK For Linux is just for the ZR300 camera model.

https://github.com/IntelRealSense/librealsense/releases/ Releases · IntelRealSense/librealsense · GitHub

2. SDK 2.0 supports recording data to a 'bag' file.

https://github.com/IntelRealSense/librealsense/blob/master/src/media/readme.md librealsense/readme.md at master · IntelRealSense/librealsense · GitHub

or to a PNG.

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

You may then be able to turn the PNG into an mpeg. Google 'convert png to mpeg' for more details.

0 项奖励
KLi21
初学者
1,680 次查看

Thank you Marty,

If using the C# wrapper, after obtaining the single VideoFrame, will the following mechanism work to save the frame as png?

// get VideoFrame from the pipeline.WaitForFrames()

var bytes = new byte[frame.Stride * frame.Height]

frame.CopyTo(bytes);

MemoryStream ms = new MemoryStream(bytes);

Image img = Image.FromStream(ms);

image.save("filename)")

I am doing prelimary investigation before we receive the camera being ordered. Thanks!

0 项奖励
MartyG
名誉分销商 III
1,680 次查看

RealSense SDK 2.0 currently supports using C++ and C. I believe that "C" refers to the original version of the language though, not C# . They may currently be working on a C# wrapper, given that C was only added in the most recent release, but I have no information about that.

I believe that when you mention a C# wrapper, you are referring to this?

https://github.com/andrecarlucci/openrealsense GitHub - andrecarlucci/openrealsense: .net wrapper for the librealsense

Whilst that wrapper would work with the original Librealsense (now known as the Legacy version), it likely would not work with SDK 2.0 without adaptations. An official C# wrapper may arrive before this unofficial wrapper can be converted.

0 项奖励
KLi21
初学者
1,680 次查看

Hi Marty,

I am actually referring to this:

https://github.com/IntelRealSense/librealsense/tree/master/wrappers/csharp librealsense/wrappers/csharp at master · IntelRealSense/librealsense · GitHub

It is part of the 2.0 open source project I believe.

0 项奖励
MartyG
名誉分销商 III
1,680 次查看

Interesting! I had forgotten that some people use the terms C# and .NET together (e.g "I wish there was C# support as I really need .NET integration). Thanks so much for bringing that to my attention. It might make it clearer to SDK 2.0 users if the Releases download page refers to '.NET / C# ' compatibility instead of just '.NET'

0 项奖励
KLi21
初学者
1,680 次查看

Hi Marty,

Yes. So is this wrapper working with sdk 2.0?

Just to get back to the original question. I checked the wrapper sample code for Capture Image example in .net c# :

https://github.com/IntelRealSense/librealsense/blob/master/wrappers/csharp/cs-tutorial-2-capture/Window.xaml.cs librealsense/Window.xaml.cs at master · IntelRealSense/librealsense · GitHub

The sample code just create the bitmap for display from the frame data (rgb 24, height is the frame.Stride and frame.Height). If to save as a file, can we create a 24 rgb bitmap c# Bitmap object? Just like the methods below.

And is the width always frame.Stride?

---------

public Bitmap CopyDataToBitmap(int height, int width, byte[] data)

{

//Here create the Bitmap to the know height, width and format

Bitmap bmp = new Bitmap(width, height, PixelFormat.Format24bppRgb);

//Create a BitmapData and Lock all pixels to be written

BitmapData bmpData = bmp.LockBits(

new Rectangle(0, 0, bmp.Width, bmp.Height),

ImageLockMode.WriteOnly, bmp.PixelFormat);

//Copy the data from the byte array into BitmapData.Scan0

Marshal.Copy(data, 0, bmpData.Scan0, data.Length);

//Unlock the pixels

bmp.UnlockBits(bmpData);

//Return the bitmap

return bmp;

}

Your help is greatly appreciated. I am almost there just need to sort out this question on saving to use the D435.

0 项奖励
MartyG
名誉分销商 III
1,680 次查看

This question is outside of my range of knowledge, regrettably. An Intel support staff member (which I am not) should be able to give advice on it, hopefully. Best of luck!

0 项奖励
KLi21
初学者
1,680 次查看

Hi all,

I checked the wrapper sample code for Capture Image example in .net c# , and trying to use in D435 camera.

https://github.com/IntelRealSense/librealsense/blob/master/wrappers/csharp/cs-tutorial-2-capture/Window.xaml.cs librealsense/Window.xaml.cs at master · IntelRealSense/librealsense · GitHub

The sample code just create the bitmap for display from the frame data (rgb 24, height is the frame.Stride and frame.Height). If to save as a file, can we create a 24 rgb bitmap c# Bitmap object? Just like the methods below.

And is the width always frame.Stride?

---------

public Bitmap CopyDataToBitmap(int height, int width, byte[] data)

{

//Here create the Bitmap to the know height, width and format

Bitmap bmp = new Bitmap(width, height, PixelFormat.Format24bppRgb);

//Create a BitmapData and Lock all pixels to be written

BitmapData bmpData = bmp.LockBits(

new Rectangle(0, 0, bmp.Width, bmp.Height),

ImageLockMode.WriteOnly, bmp.PixelFormat);

//Copy the data from the byte array into BitmapData.Scan0

Marshal.Copy(data, 0, bmpData.Scan0, data.Length);

//Unlock the pixels

bmp.UnlockBits(bmpData);

//Return the bitmap

return bmp;

}

0 项奖励
idata
员工
1,680 次查看

Hello Kenric,

 

 

It is hard to tell whether your code will work. I did find this information on frame strides that may be helpful for you:

 

 

https://msdn.microsoft.com/en-us/library/windows/desktop/aa473780%28v=vs.85%29.aspx

 

 

"When a video image is stored in memory, the memory buffer might contain extra padding bytes after each row of pixels. The padding bytes affect how the image is stored in memory, but do not affect how the image is displayed.

The stride is the number of bytes from one row of pixels in memory to the next row of pixels in memory. "

 

Regards,

 

Jesus

 

Intel Customer Support
0 项奖励
回复