How can I change the depth scale of d435i with C#
Hi, I am working on a project using d435i in my school. I try the code example and it works well. I can get a array that contains depth data of each pixel with the default settings. And I notice that the depth scale is 0.001m. And here is my question: how can I change the depth scale by C#? Because I need a smaller depth scale.And what's the smallest depth scale that d435i can reach?
And here is some parts of my code, it's almost the same as the example:
var devices = ctx.QueryDevices();
if(devices.Count==0)return;
var dev = devices[0];
var depthSensor = dev.Sensors[0];
var sp = depthSensor.StreamProfiles
.Where(p => p.Stream == Intel.RealSense.Stream.Depth)
.OrderByDescending(p => p.Framerate)
.Select(p => p.As<VideoStreamProfile>())
.First(p => p.Width == 640 && p.Height == 480);
depthSensor.Open(sp);
ushort[] depth = new ushort[640*480];
depthSensor.Start(f =>
{
using (var vf = f.As<VideoFrame>())
vf.CopyTo(depth);//get depth here
});
-
The depth units on the 400 Series can go down to 0.0001.
The depth scale can be changed with the RS2_OPTIONS_DEPTH_UNITS instruction. I could not find C# code for it, though the link below has C++ code for the change that you can use as a reference.
https://github.com/IntelRealSense/librealsense/issues/2385#issuecomment-420855050
Another approach may be to use the RealSense Viewer to set the depth units to 0.0001 and then export the Viewer's current configuration as a 'json' config file that can then be loaded with your program scripting outside of the Viewer.
Please sign in to leave a comment.
Comments
1 comment