5

I'm trying to access a live video feed from my Raspberry Pi with a PiCam attached. I have enabled the camera in the interface settings and even tested it by snapping some pictures and videos using the PiCam library. However, OpenCV is giving me troubles. I installed open CV following this tutorial (shoutout to Adrian Rosenbrock).

Check out the screenshot below for the code and the error message. I'm running everything from within a virtual environment with OpenCV installed, like Adrian suggests.

Code and error message

VIDEOIO ERROR: V4L: can't open camera by index 0

From what I've read from other problems people have had, this error is sometimes resolved by playing with the index value. If i change the index value to -1 or 1, like most solutions suggest, i either get the same thing or a slightly different "can't access camera" error.

I'm relatively new to OpenCV and RPi so I might just be missing something simple. Any suggestion is much appreciated, thanks!

1
  • opencv does not support pycam, if you connect a webcam to raspberry pi it should work. Commented Aug 2, 2018 at 4:35

1 Answer 1

4

You may need to enable access to the camera. Try typing: sudo modprobe bcm2835-v4l2 in terminal on your RPI.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.