opencv: Camera Index out of range issue - Have tried everything!!!
System information (version)
- OpenCV => 4.7.0
- Operating System / Platform => Windows 64 Bit
- Compiler => Visual Studio Code 1.76.2
Detailed description
My camera just won’t open with the code below. I have tried searching everywhere I cannot figure it out. My camera is a usb camera and works just fine. Everytime I try to run “cap = cv2.VideoCapture(1)” it outputs the error: [ERROR:0@3.185] global obsensor_uvc_stream_channel.cpp:156 cv::obsensor::getStreamChannelGroup Camera index out of range
Steps to reproduce
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
About this issue
- Original URL
- State: open
- Created a year ago
- Comments: 25 (4 by maintainers)
JUST GIVE ACCESS TO CAMERA
The following code is working on my PC. where I used Logitech external Webcam. The code is below
Change value inside VideoCapture to 0 or 1, and try it will work.
I get this as well, but only if I try to access it in a script on a RockPi:
_video_input = cv2.VideoCapture(0)
->If I do it from the interactive interpreter it works just fine.
The same script works fine on my local machine.