You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
static
CvResult CV_API_CALL cv_capture_open_with_params(
constchar* filename, int camera_index,
int* params, unsigned n_params,
CV_OUT CvPluginCapture* handle
)
{
if (!handle)
return CV_ERROR_FAIL;
*handle = NULL;
if (!filename) // <--- filename is optional, see belowreturn CV_ERROR_FAIL;
CaptureT* cap = 0;
try
{
cv::VideoCaptureParameters parameters(params, n_params);
cap = newCaptureT();
bool res;
if (filename) // if filename is true then we use
res = cap->open(std::string(filename), ¶meters); //else// however if it's nullptr
res = cap->open(camera_index, ¶meters); // then we use index to search deviceif (res)
{
*handle = (CvPluginCapture)cap;
return CV_ERROR_OK;
}
}
catch (const std::exception& e)
{
CV_LOG_WARNING(NULL, "MSMF: Exception is raised: " << e.what());
}
catch (...)
{
CV_LOG_WARNING(NULL, "MSMF: Unknown C++ exception is raised");
}
if (cap)
delete cap;
return CV_ERROR_FAIL;
}
Steps to reproduce
Open video capture from camera (for example, laptop's built-in camera) using MSMF backend cv::VideoCapture vc(0, cv::CAP_MSMF); built as a plugin.
It's also very likely, that it's the same issue as #23056
Issue submission checklist
I report the issue, it's not a question
I checked the problem with documentation, FAQ, open issues, forum.opencv.org, Stack Overflow, etc and have not found any solution
I updated to the latest OpenCV version and the issue is still there
There is reproducer code and related data files (videos, images, onnx, etc)
The text was updated successfully, but these errors were encountered:
System Information
OpenCV version: at least from 4.5.5 to master
Operating System / Platform: Windows 10/11
Compiler & compiler version: Visual Studio 2022
Detailed description
It looks like unnecessary
nullptr
check of optional argument https://github.com/opencv/opencv/blob/4.8.0/modules/videoio/src/cap_msmf.cpp#L2722Below linked fragment with my comments. By commenting out pointed
filename
check I was able to open camera on my local machine.Steps to reproduce
Open video capture from camera (for example, laptop's built-in camera) using MSMF backend
cv::VideoCapture vc(0, cv::CAP_MSMF);
built as a plugin.It's also very likely, that it's the same issue as #23056
Issue submission checklist
The text was updated successfully, but these errors were encountered: