For me CSI is fast, but when I do frame capture from the CSI camera V2.1 , I get low FPS (approx 7) at 960 х 720 resolution:(
I use rasberry pi 3b+.
Maybe I made a mistake in the code, but tried different options.
Code: Select all
rom __future__ import print_function
from picamera.array import PiRGBArray
from picamera import PiCamera
import imutils
import time
import cv2
import datetime
# initialize the camera and stream
camera = PiCamera()
camera.resolution = (960, 720)
camera.framerate = 32
rawCapture = PiRGBArray(camera, size=(960, 720))
stream = camera.capture_continuous(rawCapture, format="bgr",
use_video_port=True)
start_time = datetime.datetime.now()
mean_fps1 = []
# loop over some frames
for (i, f) in enumerate(stream):
frame = f.array
cv2.imshow("Frame", frame)
key = cv2.waitKey(1) & 0xFF
rawCapture.truncate(0)
mean_fps1.append(i)
# check to see if the desired number of frames have been reached
if i == 100:
break
t2 = (datetime.datetime.now() - start_time).total_seconds()
# stop the timer and display FPS information
print("[INFO] approx. FPS: {:.2f}".format(len(mean_fps1)/t2))
cv2.destroyAllWindows()
stream.close()
rawCapture.close()
camera.close()
Maybe it's normal, i don't know.
I really appreciate any help you can provide.