Merge pull request #22635 from hzawary:4.x

Setting CAP_PROP_AUTO_EXPOSURE on VideoCapture with backend DSHOW does not change anything. Now with this implementation the property can be used with value 1 for availability.
This commit is contained in:
Hashem Zavvari 2022-10-18 11:43:08 +03:30 committed by GitHub
parent ec7fc5adca
commit 6eb34716b8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3474,6 +3474,18 @@ bool VideoCapture_DShow::setProperty(int propIdx, double propVal)
return g_VI.isDeviceSetup(m_index);
}
case CV_CAP_PROP_AUTO_EXPOSURE:
{
// Flags are required to toggle auto exposure or not, but the setProperty interface does not support multiple parameters
bool enabled = cvRound(propVal) == 1;
long minExposure, maxExposure, delta, currentExposure, flags, defaultValue;
if (!g_VI.getVideoSettingCamera(m_index, CameraControl_Exposure, minExposure, maxExposure, delta, currentExposure, flags, defaultValue))
{
return false;
}
return g_VI.setVideoSettingCamera(m_index, CameraControl_Exposure, currentExposure, enabled ? CameraControl_Flags_Auto | CameraControl_Flags_Manual : CameraControl_Flags_Manual, enabled ? true : false);
}
case CV_CAP_PROP_AUTOFOCUS:
{
// Flags are required to toggle autofocus or not, but the setProperty interface does not support multiple parameters