https://www.pyimagesearch.com/2015/12/28/increasing-raspberry-pi-fps-with-python-and-opencv/
然後用他的sample code測了一下, 結果是:
pi@raspberrypi:~$ python3 picamera_fps_demo.py
[INFO] sampling frames from `picamera` module...
[INFO] elasped time: 3.21
[INFO] approx. FPS: 31.47 (by cv2.VideoCapture(0))
[INFO] sampling THREADED frames from `picamera` module...
[INFO] elasped time: 0.32
[INFO] approx. FPS: 309.94 (by PiVideoStream().start())
pi@raspberrypi:~$ python3 fps_demo.py
[INFO] sampling frames from webcam...
[INFO] elasped time: 3.77
[INFO] approx. FPS: 26.51 (by cv2.VideoCapture(0))
[INFO] sampling THREADED frames from webcam...
[INFO] elasped time: 1.74
[INFO] approx. FPS: 57.59 (by WebcamVideoStream(src=0).start())
看了一下code, 主要差異是讀取video的語法
[方法1: 大約30FPS]
import cv2
stream = cv2.VideoCapture(0)
[方法2: 大約58FPS]
from imutils.video import WebcamVideoStream
vs = WebcamVideoStream(src=0).start()
[方法3: 大約300FPS] 驚!!!!!!!!!!!!!!
from imutils.video.pivideostream import PiVideoStream
vs = PiVideoStream().start()
沒有留言:
張貼留言