Items with no label
3338 ディスカッション

Change the Depth map accuracy with SDK2.0

cxinl
ビギナー
5,188件の閲覧回数

Hello.

I have a question that can I Change the Depth map accuracy like this:

rs2::pipeline pipe;

rs2::pipeline_profile selection = pipe.start();

rs2::device selected_device = selection.get_device();

auto depth_sensor = selected_device.first();

if (depth_sensor.supports(RS2_OPTION_EMITTER_ENABLED))

{

depth_sensor.set_option(RS2_OPTION_EMITTER_ENABLED, 1.f); // Enable emitter

depth_sensor.set_option(RS2_OPTION_EMITTER_ENABLED, 0.f); // Disable emitter

}

if (depth_sensor.supports(RS2_OPTION_LASER_POWER))

{

// Query min and max values:

auto range = depth_sensor.get_option_range(RS2_OPTION_LASER_POWER);

depth_sensor.set_option(RS2_OPTION_LASER_POWER, range.max); // Set max power

depth_sensor.set_option(RS2_OPTION_LASER_POWER, 0.f); // Disable laser

}

Does depth_sensor.set_option(RS2_OPTION_LASER_POWER, range.max) can change dehpth accruacy. The depth image is 16 bit ,and D400 camera can detect distance of 65m,

if I set range.max to 2.0m, dose the max value 65536 I get from depth img represent 2.0m? thanks.

0 件の賞賛
10 返答(返信)
MartyG
名誉コントリビューター III
2,490件の閲覧回数

The depth scale on the 400 Series cameras, which influences accuracy, can be changed with RS2_OPTION_DEPTH_UNITS

cxinl
ビギナー
2,490件の閲覧回数

Thanks.

Default scale is 0.01, and 65535 represent 65m, is that mean I changed with RS2_OPTION_DEPTH_UNITS to 0.001, 65536 then represent 6.5m?

MartyG
名誉コントリビューター III
2,490件の閲覧回数

It is ... slightly complicated. The answer linked to below by Intel support agent Yermi is the best explanation that I know of.

cxinl
ビギナー
2,490件の閲覧回数

Thanks.

I use API

float rs2_depth_frame_get_distance(const rs2_frame* frame_ref, int x, int y, rs2_error** error);

In default, if the return value of rs2_depth_frame_get_distance represent the real distance in Meter, for example, return 1.5, is this reprensent 1.5m?

or I must multiply the scale factor of 0.01?

MartyG
名誉コントリビューター III
2,490件の閲覧回数

That question is outside of my knowledge, unfortunately. I will refer it to RealSense programming expert jb455 in the hope that they can provide useful insight.

cxinl
ビギナー
2,490件の閲覧回数
jb455
高評価コントリビューター II
2,490件の閲覧回数

rs2_depth_frame_get_distance does indeed return values in metres. If you get values from the 16 bit depth image directly, you'll need to multiply by the depth unit to get the depth in metres.

Since the D400 cameras are stereo, they only need the projector to help when looking at a region with little colour texture like a plain wall or something, then the projector adds texture to the scene so the cameras can pick out points more easily. So changing the laser power will improve depth accuracy in some circumstances, but if you're outside where IR from the sun will overpower the projector, or too far away from a wall that the projector pattern is too dim by the time it reaches it (I don't know what the max range of the projector is), the projector won't do much to help. Changing the laser power value therefore won't necessarily directly affect the depth range.

As Marty pointed out, changing the depth unit will alter the maximum reported range as well as the reported resolution (though not necessarily accuracy - just because it's reported to more decimal places doesn't automatically make it a more reliable value but in my experience at short range, it generally looks pretty good down to 0.1mm resolution), and you can clip the depth data values on the top and bottom ends using depth clamp max/min (see viewer app>advanced controls>depth table) - but I don't think that will affect the values left over in the middle at all. To improve the reliability of the depth values, you could look at the post-processing options to alleviate random errors.

cxinl
ビギナー
2,490件の閲覧回数

Thanks to jb455.

I use 415 and 435 to reconstuct face 3D model, and I found it can't see the eyes area clearly, so I think maybe the depth resolution is not good

jb455
高評価コントリビューター II
2,490件の閲覧回数

Are you creating the model from a single frame or using multiple frames? If the latter, perhaps the algorithm you're using has some sort of resolution parameter?

Using a single frame with depth unit set to 0.0001 (0.1mm) I can get much better resolution than you have there.

cxinl
ビギナー
2,490件の閲覧回数

Oh, the later method. I just use default configs ,so I don't know wether I need do some works to set the depth unit . My resolution both rgb and depth are 640x480

返信