forked from NationalAssociationOfRealtors/VehicleCounting
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfps.py
More file actions
34 lines (23 loc) · 744 Bytes
/
fps.py
File metadata and controls
34 lines (23 loc) · 744 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import cv2
import time
if __name__ == '__main__' :
# Start default camera
video = cv2.VideoCapture("rtsp://crtlabs:Abudabu1!@430n.crtlabs.org:554/videoMain");
# Number of frames to capture
num_frames = 120;
print "Capturing {0} frames".format(num_frames)
# Start time
start = time.time()
# Grab a few frames
for i in xrange(0, num_frames) :
ret, frame = video.read()
# End time
end = time.time()
# Time elapsed
seconds = end - start
print "Time taken : {0} seconds".format(seconds)
# Calculate frames per second
fps = num_frames / seconds;
print "Estimated frames per second : {0}".format(fps);
# Release video
video.release()