MCPcopy Create free account
hub / github.com/alpha2phi/python-apps / calculate_fps

Function calculate_fps

computer-vision/01_code_base_video_capture.py:5–18  ·  view source on GitHub ↗
(img, pTime, pos=(50, 80), color=(0, 255, 0), scale=4, thickness=4)

Source from the content-addressed store, hash-verified

3
4
5def calculate_fps(img, pTime, pos=(50, 80), color=(0, 255, 0), scale=4, thickness=4):
6 cTime = time.time()
7 fps = 1 / (cTime - pTime)
8 pTime = cTime
9 cv2.putText(
10 img,
11 f"FPS: {int(fps)}",
12 pos,
13 cv2.FONT_HERSHEY_PLAIN,
14 scale,
15 color,
16 thickness,
17 )
18 return pTime, img
19
20
21def show_video(capture):

Callers 1

show_videoFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected