sample_code/face-recognition-with-opencv/fps.py
2025-03-14 12:04:48 +08:00

12 lines
291 B
Python

import time
class FPS:
def __init__(self):
self.prev_time = time.time()
self.fps = 0
def update(self):
current_time = time.time()
self.fps = 1 / (current_time - self.prev_time)
self.prev_time = current_time
return self.fps