Log a debug message if a capture backend is generally available but isn't capabable of a capture mode.

pull/22700/head
kallaballa 3 years ago committed by Alexander Smorkalov
parent 6160104fd7
commit a2be9e9fc1
  1. 22
      modules/videoio/src/cap.cpp

@ -196,6 +196,17 @@ bool VideoCapture::open(const String& filename, int apiPreference, const std::ve
}
}
if(apiPreference != CAP_ANY)
{
bool found = cv::videoio_registry::isBackendBuiltIn(static_cast<VideoCaptureAPIs>(apiPreference));
if (found)
{
CV_LOG_WARNING(NULL, cv::format("VIDEOIO(%s): backend is generally available "
"but can't be used to capture by name",
cv::videoio_registry::getBackendName(static_cast<VideoCaptureAPIs>(apiPreference)).c_str()));
}
}
if (throwOnFail)
{
CV_Error_(Error::StsError, ("could not open '%s'", filename.c_str()));
@ -310,6 +321,17 @@ bool VideoCapture::open(int cameraNum, int apiPreference, const std::vector<int>
}
}
if(apiPreference != CAP_ANY)
{
bool found = cv::videoio_registry::isBackendBuiltIn(static_cast<VideoCaptureAPIs>(apiPreference));
if (found)
{
CV_LOG_WARNING(NULL, cv::format("VIDEOIO(%s): backend is generally available "
"but can't be used to capture by index",
cv::videoio_registry::getBackendName(static_cast<VideoCaptureAPIs>(apiPreference)).c_str()));
}
}
if (throwOnFail)
{
CV_Error_(Error::StsError, ("could not open camera %d", cameraNum));

Loading…
Cancel
Save