From 08953f121189071a6ea9b13f1a0313ec41b7b9e0 Mon Sep 17 00:00:00 2001 From: Nicolas Pope <nwpope@utu.fi> Date: Fri, 17 Jul 2020 13:27:53 +0300 Subject: [PATCH] Allow config exposure change --- .../rgbd-sources/src/sources/stereovideo/pylon.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/components/rgbd-sources/src/sources/stereovideo/pylon.cpp b/components/rgbd-sources/src/sources/stereovideo/pylon.cpp index 9851ab4c0..515aadda3 100644 --- a/components/rgbd-sources/src/sources/stereovideo/pylon.cpp +++ b/components/rgbd-sources/src/sources/stereovideo/pylon.cpp @@ -96,6 +96,15 @@ PylonDevice::PylonDevice(nlohmann::json &config) left_hm_ = cv::cuda::HostMem(height_, width_, CV_8UC4); right_hm_ = cv::cuda::HostMem(height_, width_, CV_8UC4); hres_hm_ = cv::cuda::HostMem(fullheight_, fullwidth_, CV_8UC4); + + on("exposure", [this](const ftl::config::Event &e) { + if (lcam_->GetDeviceInfo().GetModelName() != "Emulation") { + lcam_->ExposureTime.SetValue(value("exposure", 24000.0f)); // Exposure time in microseconds + } + if (rcam_ && rcam_->GetDeviceInfo().GetModelName() != "Emulation") { + rcam_->ExposureTime.SetValue(value("exposure", 24000.0f)); // Exposure time in microseconds + } + }); } PylonDevice::~PylonDevice() { @@ -149,7 +158,7 @@ void PylonDevice::_configureCamera(CBaslerUniversalInstantCamera *cam) { if (cam->GetDeviceInfo().GetModelName() != "Emulation") { // Emulated device throws exception with these - cam->ExposureTime.SetValue(24000.0f); // Exposure time in microseconds + cam->ExposureTime.SetValue(value("exposure", 24000.0f)); // Exposure time in microseconds cam->LightSourcePreset.SetValue(Basler_UniversalCameraParams::LightSourcePreset_Tungsten2800K); // White balance option } } -- GitLab