Skip to content
This repository has been archived by the owner on Jun 7, 2024. It is now read-only.
This repository is currently being migrated. It's locked while the migration is in progress.

Commit

Permalink
Merge pull request #44 from AkiraShibata18/2022.05.31-add-roi-auto-ex…
Browse files Browse the repository at this point in the history
…posure

add ROI auto exposure and auto white balance
  • Loading branch information
AkiraShibata18 authored Jun 6, 2022
2 parents b0539d1 + adcc428 commit 90b54a6
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
13 changes: 12 additions & 1 deletion spinnaker_camera_driver/cfg/Spinnaker.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ gen.add("exposure_mode", str_t, SensorLevels.RECON
gen.add("exposure_auto", str_t, SensorLevels.RECONFIGURE_RUNNING, "Sets the automatic exposure mode to: 'Off', 'Once' or 'Continuous'", "Continuous")
gen.add("exposure_time", double_t, SensorLevels.RECONFIGURE_RUNNING, "Exposure time in microseconds when Exposure Mode is Timed and Exposure Auto is not Continuous.", 100.0, 0.0, 3000000.0)
gen.add("auto_exposure_time_upper_limit", double_t, SensorLevels.RECONFIGURE_RUNNING, "Upper Limit on Shutter Speed.", 50000.0, 0.0, 3000000.0)

gen.add("auto_exposure_time_lower_limit", double_t, SensorLevels.RECONFIGURE_RUNNING, "Lower Limit on Shutter Speed.", 100.0, 0.0, 3000000.0)

# Gain Settings
gen.add("gain_selector", str_t, SensorLevels.RECONFIGURE_RUNNING, "Selects which gain to control. The All selection is a total amplification across all channels.", "All")
Expand Down Expand Up @@ -414,4 +414,15 @@ gen.add('ignore_incomplete_image', bool_t, SensorLevels.RECONFIGURE_STOP, "Conti
# DefectCorrectStaticEnable
gen.add("defect_correct_static_enable", bool_t, SensorLevels.RECONFIGURE_RUNNING, "DefectCorrectStaticEnable", True)

# set ROI auto algorithm
auto_algorithm_selector = gen.enum([gen.const("AutoWhiteBalance", str_t, "Awb", ""),
gen.const("AutoExposure", str_t, "Ae", "")],
"Selects auto algorithm applied ROI.")
gen.add("auto_algorithm_selector", str_t, SensorLevels.RECONFIGURE_RUNNING, "ROI Auto Algorithm Selector", "Ae", edit_method=auto_algorithm_selector)
gen.add("roi_enable", bool_t, SensorLevels.RECONFIGURE_RUNNING, "ROI enable", False)
gen.add("roi_offset_x", int_t, SensorLevels.RECONFIGURE_RUNNING, "ROI OffsetX", 0, 0, 4000)
gen.add("roi_offset_y", int_t, SensorLevels.RECONFIGURE_RUNNING, "ROI OffsetY", 0, 0, 4000)
gen.add("roi_width", int_t, SensorLevels.RECONFIGURE_RUNNING, "ROI Width", 1000, 0, 4000)
gen.add("roi_height", int_t, SensorLevels.RECONFIGURE_RUNNING, "ROI Width", 1000, 0, 4000)

exit(gen.generate(PACKAGE, "spinnaker_camera_driver", "Spinnaker"))
9 changes: 9 additions & 0 deletions spinnaker_camera_driver/src/camera.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,8 @@ void Camera::setNewConfiguration(SpinnakerConfig& config, const uint32_t& level)
{
setProperty(node_map_, "AutoExposureExposureTimeUpperLimit",
static_cast<float>(config.auto_exposure_time_upper_limit));
setProperty(node_map_, "AutoExposureExposureTimeLowerLimit",
static_cast<float>(config.auto_exposure_time_lower_limit));
}
Spinnaker::GenApi::CFloatPtr ptrExposureTime = node_map_->GetNode("ExposureTime");
config.exposure_time = ptrExposureTime->GetValue();
Expand Down Expand Up @@ -321,6 +323,13 @@ void Camera::setNewConfiguration(SpinnakerConfig& config, const uint32_t& level)
setProperty(node_map_, "CounterDelay", config.counter_delay);
setProperty(node_map_, "CounterTriggerSource", config.counter_trigger_source);
setProperty(node_map_, "CounterTriggerActivation", config.counter_trigger_activation);

setProperty(node_map_, "AutoAlgorithmSelector", config.auto_algorithm_selector);
setProperty(node_map_, "AasRoiEnable", config.roi_enable);
setProperty(node_map_, "AasRoiOffsetX", config.roi_offset_x);
setProperty(node_map_, "AasRoiOffsetY", config.roi_offset_y);
setProperty(node_map_, "AasRoiWidth", config.roi_width);
setProperty(node_map_, "AasRoiHeight", config.roi_height);
}
catch (const Spinnaker::Exception& e)
{
Expand Down

0 comments on commit 90b54a6

Please sign in to comment.