mirror of
https://github.com/opencv/opencv.git
synced 2026-09-13 13:55:39 -05:00
videoio: clamp ueye CAP_PROP_GAIN to SDK's documented [0,100] range
is_SetHardwareGain's master-gain parameter is documented as 0-100; out-of-range values are not guaranteed to be handled predictably by the SDK, so clamp before passing through.
This commit is contained in:
@@ -212,9 +212,12 @@ bool VideoCapture_uEye::setProperty(int property_id, double value)
|
||||
ASSERT_UEYE(is_Exposure(cam_id, IS_EXPOSURE_CMD_SET_EXPOSURE, (void*)&value, sizeof(value)));
|
||||
break;
|
||||
case CAP_PROP_GAIN:
|
||||
ASSERT_UEYE(is_SetHardwareGain(cam_id, static_cast<int>(value), IS_IGNORE_PARAMETER, IS_IGNORE_PARAMETER, IS_IGNORE_PARAMETER));
|
||||
{
|
||||
int master = std::min(100, std::max(0, static_cast<int>(value)));
|
||||
ASSERT_UEYE(is_SetHardwareGain(cam_id, master, IS_IGNORE_PARAMETER, IS_IGNORE_PARAMETER, IS_IGNORE_PARAMETER));
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(set_format)
|
||||
{
|
||||
set_matching_format(cam_id, sensor_info, width, height);
|
||||
|
||||
Reference in New Issue
Block a user