evgeny_co
Posts: 1
Joined: Fri Feb 22, 2019 5:24 pm

Low FPS, Rasberrry 3b+, CSI camera V2.1

Fri Feb 22, 2019 6:00 pm

Hi everyone!

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()
 
I get ~7 fps.
Maybe it's normal, i don't know.
I really appreciate any help you can provide.

User avatar
paddyg
Posts: 2555
Joined: Sat Jan 28, 2012 11:57 am
Location: UK

Re: Low FPS, Rasberrry 3b+, CSI camera V2.1

Mon Feb 25, 2019 10:28 pm

Probably alternative simpler methods but I did something a while ago (based on the picam docs I think) that used a io.BytesIO and a thread pool to up the frame rate. https://github.com/pi3d/pi3d_demos/blob ... re_fast.py I wanted to get the frames as numpy arrays so there's complication in there that you don't need.

PS somewhere here https://picamera.readthedocs.io/en/rele ... processing
PPS I don't know how fast imshow will run on the RPi
also https://groups.google.com/forum/?hl=en-GB&fromgroups=#!forum/pi3d

Return to “Python”