catrueeb
Posts: 5
Joined: Wed May 15, 2019 7:44 am

PiCamera Continuous Frame Capture

Sat Jun 08, 2019 6:18 pm

Hi All,

I am streaming from multiple cameras over a Network and it has to be as fast as possible. Since I have to process the images, I am using PiCamera.capture_continuous(). But even after doing a lot of online research, this does not give the desired output. I would like to capture (640x480) at minimum 30Hz, but it is much slower, even without any image processing. Using the VideoCapture() class of OpenCV 3, I can achieve 40Hz at (640x480) easily.. Where am I losing time? There has to be a way to get faster continuous image capturing. Here is the code to reproduce:

Code: Select all

	fs =30
	frames = fs*10
	camera = PiCamera(sensor_mode = 7, framerate = fs)
	camera.resolution = (640,480)
	rawCapture = PiRGBArray(camera, size=camera.resolution)
	print("Camera Sensor mode: {}".format(camera.sensor_mode))
	print("Camera resolution: {}".format(camera.resolution))
	print("Camera zoom: {}".format(camera.zoom))
	start = time.time()
	for frame, i in zip(camera.capture_continuous(rawCapture, format="bgr", use_video_port=True), range(frames)):
		image = frame.array
		rawCapture.truncate(0)
	print("Time for {0} frames: {1} seconds".format(frames ,time.time()-start))
This does not even perform at 20Hz.
Thanks....

Return to “Camera board”