IntelRealSense / librealsense

Intel® RealSense™ SDK
https://www.intelrealsense.com/
Apache License 2.0
7.6k stars 4.83k forks source link

Setting exposure fails with D405 #11981

Closed DaveBGld closed 1 year ago

DaveBGld commented 1 year ago

Required Info
Camera Model D405
Firmware Version 5.15.0.2
Operating System & Version Ubuntu20.04
Kernel Version (Linux Only) 5.15.0-76-generic
Platform PC
SDK Version latest built from code2.54.1.0
Language {C++ }
Segment {Robot}

Issue Description

I have code developed for the D435i, where control of exposure is important to improve the performance of the Machine Learning Vision Pipeline.

First Problem Auto exposure fails:

auto colorSensor = profile.get_device().query_sensors()[1];
colorSensor.set_option(RS2_OPTION_ENABLE_AUTO_EXPOSURE, 1);

Throws a exception at VALIDATE_OPTION(options, option); inside rs2_set_option

Second Problem, Manual exposure is ignored:

int exposureValue = 450;
auto depthSensor = profile.get_device().query_sensors()[0];
depthSensor.set_option(RS2_OPTION_ENABLE_AUTO_EXPOSURE, 0);
auto colorSensor = profile.get_device().query_sensors()[1];
colorSensor.set_option(RS2_OPTION_ENABLE_AUTO_EXPOSURE, 0);
colorSensor.set_option(RS2_OPTION_EXPOSURE, exposureValue);

It doesn't matter what value I give the exposure, the color image is too dark, even at maximum 10000, and also sometimes throws the same exception as above.

Thanks for the help!

MartyG-RealSense commented 1 year ago

Hi @DaveBGld As mentioned in your other question at https://github.com/IntelRealSense/librealsense/issues/11982 the D405 does not have an RGB sensor component and obtains RGB from the depth sensor. There is therefore no exposure control for an RGB sensor. The RGB exposure is set by changing the depth sensor exposure. The depth sensor index is '0' instead of '1'.

Increasing the depth exposure value (which has a default value of '33000') brightens the RGB image and reducing the value darkens it. You can test this in the RealSense Viewer by enabling both the depth and color streams and changing the exposure value under the Stereo Module > Controls section of the options side-panel.

DaveBGld commented 1 year ago

@MartyG-RealSense Thanks !