always produced 8500 despite clear changes to auto-exposure.
I then tried reading the metadata as suggested, but the RS2_FRAME_METADATA_ACTUAL_EXPOSURE is not provided. See the following code for printing what metadata is available:
#include <iostream>
#include <librealsense2/rs.hpp>
rs2::config ConfigPipeline() {
int width = 640;
int height = 480;
rs2::config cfg;
cfg.enable_stream(RS2_STREAM_INFRARED, 1, width, height);
cfg.enable_stream(RS2_STREAM_INFRARED, 2, width, height);
return cfg;
}
void ConfigSensors(rs2::device &dev) {
for (auto &s : dev.query_sensors()) {
if (s.supports(rs2_option::RS2_OPTION_EMITTER_ENABLED)) {
s.set_option(rs2_option::RS2_OPTION_EMITTER_ENABLED, 0);
}
if (s.supports(rs2_option::RS2_OPTION_ENABLE_AUTO_EXPOSURE)) {
s.set_option(rs2_option::RS2_OPTION_ENABLE_AUTO_EXPOSURE, 1);
}
}
}
void PrintMetadataStatus(rs2::video_frame &vf) {
if (vf) {
auto metadata =
rs2_frame_metadata_value::RS2_FRAME_METADATA_ACTUAL_EXPOSURE;
for (auto i = 0; i < rs2_frame_metadata_value::RS2_FRAME_METADATA_COUNT;
++i) {
auto metadata = static_cast<rs2_frame_metadata_value>(i);
bool supported = vf.supports_frame_metadata(metadata);
std::cout << "Supports metadata " << i << " ("
<< rs2_frame_metadata_to_string(metadata) << "):\t"
<< (supported ? "true" : "false") << std::endl;
if (supported) {
std::cout << vf.get_frame_metadata(metadata) << std::endl;
}
}
}
}
int main(int argc, char *argv[]) {
rs2::pipeline pipe;
pipe.start(ConfigPipeline());
rs2::device dev = pipe.get_active_profile().get_device();
ConfigSensors(dev);
while (true) {
auto frameset = pipe.wait_for_frames();
auto infra_frame_0 = frameset.get_infrared_frame(0);
std::cout << "Infra frame 0: " << (infra_frame_0 ? "true" : "false")
<< std::endl;
PrintMetadataStatus(infra_frame_0);
auto infra_frame_1 = frameset.get_infrared_frame(1);
std::cout << "Infra frame 1: " << (infra_frame_1 ? "true" : "false")
<< std::endl;
PrintMetadataStatus(infra_frame_1);
}
}
As you can see, Supports metadata 3 (Actual Exposure) is true, but the exposure is constantly at 10000 even when the gain changes. How do I get the exposure value selected by autoexposure for the IR images taken? Thanks!
Issue Description
I am unable to figure out how to read the exposure value for the IR cameras with auto-exposure enabled. I tried to follow the suggestion from https://github.com/IntelRealSense/librealsense/issues/1624#issuecomment-389085387 but the approach
always produced
8500
despite clear changes to auto-exposure.I then tried reading the metadata as suggested, but the
RS2_FRAME_METADATA_ACTUAL_EXPOSURE
is not provided. See the following code for printing what metadata is available:compiled with
which prints in a loop
As you can see,
Supports metadata 3 (Actual Exposure)
istrue
, but the exposure is constantly at10000
even when the gain changes. How do I get the exposure value selected by autoexposure for the IR images taken? Thanks!