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:
dheeraj singh
2026-08-06 17:23:05 +05:30
parent 6c0fdcce9a
commit da9fec9c47

View File

@@ -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);