cv2 and picamera

3 posts / 0 new
Last post
awood85
awood85's picture
cv2 and picamera

Being a python beginner I think I'm missing something regarding the picamera use and opencv's cv2 or am I just being a nump(t)y ?

Isn't cv2 aimed at usb camera usage and not the picamera so calls to cv2.VideoCapture(0) give: TypeError Required argument 'device' (pos 1) not found.

Thanks

Adam

piborg
piborg's picture
Pi Camera and OpenCV

Originally we did use the picamera module to get the video feed.
The trouble is that we did not seem to be able to get enough speed out of it at higher frame rates.

We changed to using the standard OpenCV interface for accessing cameras to get around this problem.
The cv2.VideoCapture class works with any attached camera which supports Video4Linux (V4L).

By default the Pi Camera does not have Video4Linux support, but a driver has been written already for it.
Our script (Formula.py) loads this driver using the command: sudo modprobe bcm2835-v4l2 before trying to talk to the camera.

The simulator also uses this interface to open a network stream for processing images.

awood85
awood85's picture
Ah great, thanks for clearing

Ah great, thanks for clearing that up.

Adam

Add new comment

Filtered HTML

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd> <pre>
  • Syntax highlight code surrounded by the <pre class="brush: lang">...</pre> tags, where lang is one of the following language brushes: bash, cpp, perl, python.
  • Lines and paragraphs break automatically.

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Comment Images
Files must be less than 10 MB.
Allowed file types: png gif jpg jpeg.
Comment Attachments
Files must be less than 10 MB.
Allowed file types: txt pdf nfo doc docx rtf jpg png gif bmp zip tar gz csv xls.
CAPTCHA
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.