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

Function show_video

computer-vision/01_code_base_video_capture.py:21–44  ·  view source on GitHub ↗
(capture)

Source from the content-addressed store, hash-verified

19
20
21def show_video(capture):
22 # cap = cv2.VideoCapture(0) # Capture from camera. Adjust the number
23 cap = cv2.VideoCapture(capture) # Capture from video
24
25 try:
26
27 pTime = time.time()
28 while cap.isOpened():
29 # Read from video capture device
30 success, img = cap.read()
31
32 # FPS
33 pTime, img = calculate_fps(img, pTime)
34
35 # Show video
36 if img is not None:
37 cv2.imshow("Video", img)
38
39 # Wait for key to exit
40 if cv2.waitKey(10) & 0xFF == ord("q"):
41 break
42 finally:
43 cap.release()
44 cv2.destroyAllWindows()
45
46
47if __name__ == "__main__":

Callers 1

Calls 1

calculate_fpsFunction · 0.70

Tested by

no test coverage detected