My camera module is the same as that in this video. After the installation of openCV on Pi, I use following command to start my camera module:
sudo modprobe bcm2835-v4l2
Then, I run the following openCV code:
Then, I can see the window displaying video, but its update frequency is too slow, about 0.2Hz. It needs 5 seconds to update one frame!!! I guess it might be the reason of its high resolution. I do not need high resolution. I only need high update frequency, at lest 10Hz. How to solve my problem? Thank you.
Code: Select all
import cv cv.NamedWindow("w1", cv.CV_WINDOW_AUTOSIZE) camera_index = 0 capture = cv.CaptureFromCAM(camera_index) def repeat(): global capture #declare as globals since we are assigning to them now global camera_index frame = cv.QueryFrame(capture) cv.ShowImage("w1", frame) c = cv.WaitKey(10) if(c=="n"): #in "n" key is pressed while the popup window is in focus camera_index += 1 #try the next camera index capture = cv.CaptureFromCAM(camera_index) if not capture: #if the next camera index didn't work, reset to 0. camera_index = 0 capture = cv.CaptureFromCAM(camera_index) while True: repeat()