Python——计算程序运行帧率(FPS)

完整代码:

from cv2 import getTickCount, getTickFrequency

loop_start = getTickCount()
# 中间测帧率的代码段
loop_time = cv2.getTickCount() - loop_start

total_time = loop_time/(cv2.getTickFrequency()) # 使用getTickFrequency()更加准确
running_FPS = int(1/total_time) # 帧率取整
print("running_FPS:",running_FPS)

你可能感兴趣的:(编程语言,python,帧率,FPS)