-
-
Notifications
You must be signed in to change notification settings - Fork 56.5k
VideoCapture nullptr exception due to read access violation. #19368
Copy link
Copy link
Closed
Description
System information (version)
- OpenCV => 4.5.1
- Operating System / Platform => Windows 64 Bit
- Compiler => Visual Studio 2019
Detailed description
Hello! :) This only appears to happen when using a camera index of 2 and when in combination with CAP_DSHOW.
It won't crash otherwise.
May be worth noting that afaik I only have two capture devices on my computer, which can be accessed using index 0 and 1 (+ DSHOW offset). These two don't crash when calling VideoCapture.open(). Neither does any other integer except for 2. I'm not sure how to confirm this though so if anyone has an idea of how I could figure out exactly how many capture devices on my computer so I can share it here, then I'd be happy to. Thanks! :)
Line 146 cvstd_wrapper.hpp
Exception thrown: read access violation.
**pVih** was nullptr.
Call Stack
opencv_world451d.dll!videoInput::start(int deviceID, videoDevice * VD) Line 2744 C++
opencv_world451d.dll!videoInput::setup(int deviceNumber) Line 2210 C++
opencv_world451d.dll!videoInput::setupDevice(int deviceNumber) Line 1187 C++
opencv_world451d.dll!cv::VideoCapture_DShow::open(int index) Line 3592 C++
opencv_world451d.dll!cv::VideoCapture_DShow::VideoCapture_DShow(int index) Line 3346 C++
[External Code]
opencv_world451d.dll!cv::makePtr<cv::VideoCapture_DShow,int>(const int & <a1_0>) Line 146 C++
opencv_world451d.dll!cv::create_DShow_capture(int index) Line 3609 C++
opencv_world451d.dll!cv::StaticBackend::createCapture(int camera) Line 28 C++
opencv_world451d.dll!cv::VideoCapture::open(int cameraNum, int apiPreference) Line 219 C++
aiheadtrack.exe!main() Line 7 C++
Steps to reproduce
#include <opencv2/highgui/highgui.hpp>
int main()
{
cv::VideoCapture cap;
cap.open(2, cv::CAP_DSHOW);
return 0;
}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 solution - I updated to latest OpenCV version and the issue is still there
- There is reproducer code and related data files: videos, images, onnx, etc
Reactions are currently unavailable