I am working on a project where I need to use opencv to get image data in python from the pi camera module. I have seen the tutorials on how to do this with C++ but not too much in python. I did find this link which had me install the official kernel V4L2 driver bcm2835-v4l2. Once I did this I was able to capture the stream from the pi but the stream shows up tiny...probably about 5x5 pixels. I couldn't find anyone else who has encountered this problem. Any ideas?
Below is the simple code I am using for the capture:
import cv2 import numpy as np cap = cv2.VideoCapture(-1) while(True): # Capture frame-by-frame ret, frame = cap.read() cv2.imshow('frame',frame) if cv2.waitKey(1) & 0xFF == ord('q'): break # When everything done, release the capture cap.release() cv2.destroyAllWindows() EDIT: I also forgot to mention that when I run the script, I get this error before the window shows up. I am assuming it occurs when cap is created.
VIDIOC_QUERYMENU: Invalid argument VIDIOC_QUERYMENU: Invalid argument VIDIOC_QUERYMENU: Invalid argument VIDIOC_QUERYMENU: Invalid argument VIDIOC_QUERYMENU: Invalid argument VIDIOC_QUERYMENU: Invalid argument VIDIOC_QUERYMENU: Invalid argument VIDIOC_QUERYMENU: Invalid argument VIDIOC_QUERYMENU: Invalid argument VIDIOC_QUERYMENU: Invalid argument VIDIOC_QUERYMENU: Invalid argument VIDIOC_QUERYMENU: Invalid argument VIDIOC_QUERYMENU: Invalid argument VIDIOC_QUERYMENU: Invalid argument