When I use PiCamera, I have capture stills or video. They describe that there is a difference between the two. I find stills are slower when capturing continuously. Video is a faster frame rate.
When I use VideoCapture in OpenCV, it seems to capture at the similar rate of continuous stills. I have an example python script to show my findings. I tested 5 seconds of capture on a Sony IMX219 at a resolution of 1920X1080:
- PiCamera Video: 146 frames at 28.81fps fileSize: 75KB
- PiCamera Stills: 8 frames at 1.78fps fileSize: 12.3 MB
- OpenCV VideoCapture: 14 frames at 3.12fps fileSize: 670KB
In all three cases, I tried to optimize by not writing to disk and just capture in memory to rule out disk I/O.
Is there another setting in OpenCV that I should be using like it appears that PiCamera is doing?
@MarkSetchell, Setting the CAP_PROP_FPS seems to have no effect.
@MarkSetchell, Running opencv first doesn't make a difference. I noticed this on a system that didn't even have picamera installed. Example script has been updated though.
@MarkSetchell, cv2.getBuildInformation()
@MarkSetchell, If I enable file creation the picamera stills are larger than opencv. I listed the file sizes above
Does this mean bcm2835_v4l2 is loaded but not being used? lsmod | grep
Module Size Used by
bcm2835_v4l2 45056 0
cm2835_v4l2 45056 0
v4l2_mem2mem 24576 1 bcm2835_codec
bcm2835_mmal_vchiq 32768 2 bcm2835_codec,bcm2835_v4l2
v4l2_common 16384 1 bcm2835_v4l2
videobuf2_vmalloc 16384 1 bcm2835_v4l2
videobuf2_v4l2 24576 3 bcm2835_codec,bcm2835_v4l2,v4l2_mem2mem
videobuf2_common 45056 4 bcm2835_codec,bcm2835_v4l2,v4l2_mem2mem,videobuf2_v4l2
videodev 200704 6 bcm2835_codec,v4l2_common,videobuf2_common,bcm2835_v4l2,v4l2_mem2mem,videobuf 2_v4l2 media 36864 3 bcm2835_codec,videodev,v4l2_mem2mem