- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am getting ready for a trade show where I am showing off a live projection masking program based on the realsense sdk 2.0. I am cleaning up my masks by running a pixel difference calculation on subjects entering the scene and a reference image without them. This works perfectly, except the camera will occasionally adjust its automatic settings when a subject enters, changing more about the image than the fact that the subject is in frame as a result.
I already lock down exposure on my camera profile:
pipeProfile.get_device().first<rs2::depth_sensor().set_option(RS2_OPTION_ENABLE_AUTO_EXPOSURE, false);
int new_exposure = pipeProfile.get_device().first<rs2::depth_sensor().get_option(RS2_OPTION_EXPOSURE);
pipeProfile.get_device().first<rs2::depth_sensor>().set_option(RS2_OPTION_EXPOSURE, new_exposure);
But I found all of these other options here:
I am wondering which of these might influence the RGB sensor's image and how to disable the automatic image adjustment in a similar method to what I am currently doing for auto-exposure. Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you as always for pointing me in the right direction! For future visitors, here is the complete solution:
auto&& dev = list[0]; //where list is the set returned from ctx.query_devices()
rs2::sensor depth_sensor;
rs2::sensor color_sensor;
auto advanced_dev = dev.as<rs400::advanced_mode>();
auto advanced_sensors = advanced_dev.query_sensors();
bool depth_found = false;
bool color_found = false;
for (auto&& sensor : advanced_sensors) {
std::string module_name = sensor.get_info(RS2_CAMERA_INFO_NAME);
std::cout << module_name << std::endl;
if (module_name == "Stereo Module") {
depth_sensor = sensor;
depth_found = true;
}
else if (module_name == "RGB Camera") {
color_sensor = sensor;
color_found = true;
}
}
if (!(depth_found && color_found)) {
std::cout << "Unable to find both stereo and color modules" <<
std::endl;
}
//Adjust depth sensor auto exposure
depth_sensor.set_option(RS2_OPTION_ENABLE_AUTO_EXPOSURE, false);
int new_exposure = depth_sensor.get_option(RS2_OPTION_EXPOSURE);
depth_sensor.set_option(RS2_OPTION_EXPOSURE, new_exposure);
//Adjust color sensor auto exposure
color_sensor.set_option(RS2_OPTION_ENABLE_AUTO_EXPOSURE, false);
new_exposure = color_sensor.get_option(RS2_OPTION_EXPOSURE);
color_sensor.set_option(RS2_OPTION_EXPOSURE, new_exposure);
//Disable auto white balance on color
color_sensor.set_option(RS2_OPTION_ENABLE_AUTO_WHITE_BALANCE, false);
int new_white_balance = color_sensor.get_option(RS2_OPTION_WHITE_BALANCE);
color_sensor.set_option(RS2_OPTION_WHITE_BALANCE, new_white_balance);
And just as a heads up, if you try something "silly" like adjusting white balance for the depth sensor, you will get a rather ambiguous runtime error. Just be careful about what settings you change! And make sure you have imported the rs_advanced_mode.hpp file!
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Any of the first 12 options in that list (all of the ones with 'Color' in their description) could potentially affect the RGB image.
If you have experimented with the RealSense Viewer program, you may have noticed that both the depth controls and the RGB controls have an auto-exposure option. Disabling the color auto-exposure is a bit trickier than just disabling the depth auto-exposure alone, as both modes use the same RS2_OPTION_ENABLE_AUTO_EXPOSURE instruction, and you have to differentiate between them with a descriptor at the start of the code line.
For example, one user differentiated between the depth and color sensors with the descriptors ' realSenseSensor.set' for the color auto-exposure and 'realSenseSensorDepth.set' for the depth auto-exposure. The complication is that these descriptor terms need to be defined earlier in the script.
The best reference that I know of for setting up these custom references is in a long script in the first message of the discussion linked to below.
https://github.com/IntelRealSense/librealsense/issues/2637
In that discussion, the user first defines terms called depth_sensor and color_sensor with these lines:
rs2::sensor depth_sensor;
rs2::sensor color_sensor;
Further down the script, they use these descriptors in two separate blocks of the code to differentiate between depth and color sensors when disabling auto-exposure by setting them to '0' (setting them to '1' enables them).
depth_sensor.set_option(RS2_OPTION_ENABLE_AUTO_EXPOSURE, 0);
color_sensor.set_option(RS2_OPTION_ENABLE_AUTO_EXPOSURE, 0);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you as always for pointing me in the right direction! For future visitors, here is the complete solution:
auto&& dev = list[0]; //where list is the set returned from ctx.query_devices()
rs2::sensor depth_sensor;
rs2::sensor color_sensor;
auto advanced_dev = dev.as<rs400::advanced_mode>();
auto advanced_sensors = advanced_dev.query_sensors();
bool depth_found = false;
bool color_found = false;
for (auto&& sensor : advanced_sensors) {
std::string module_name = sensor.get_info(RS2_CAMERA_INFO_NAME);
std::cout << module_name << std::endl;
if (module_name == "Stereo Module") {
depth_sensor = sensor;
depth_found = true;
}
else if (module_name == "RGB Camera") {
color_sensor = sensor;
color_found = true;
}
}
if (!(depth_found && color_found)) {
std::cout << "Unable to find both stereo and color modules" <<
std::endl;
}
//Adjust depth sensor auto exposure
depth_sensor.set_option(RS2_OPTION_ENABLE_AUTO_EXPOSURE, false);
int new_exposure = depth_sensor.get_option(RS2_OPTION_EXPOSURE);
depth_sensor.set_option(RS2_OPTION_EXPOSURE, new_exposure);
//Adjust color sensor auto exposure
color_sensor.set_option(RS2_OPTION_ENABLE_AUTO_EXPOSURE, false);
new_exposure = color_sensor.get_option(RS2_OPTION_EXPOSURE);
color_sensor.set_option(RS2_OPTION_EXPOSURE, new_exposure);
//Disable auto white balance on color
color_sensor.set_option(RS2_OPTION_ENABLE_AUTO_WHITE_BALANCE, false);
int new_white_balance = color_sensor.get_option(RS2_OPTION_WHITE_BALANCE);
color_sensor.set_option(RS2_OPTION_WHITE_BALANCE, new_white_balance);
And just as a heads up, if you try something "silly" like adjusting white balance for the depth sensor, you will get a rather ambiguous runtime error. Just be careful about what settings you change! And make sure you have imported the rs_advanced_mode.hpp file!
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page