giahan commited on
Commit
6f53cc7
·
1 Parent(s): 1e87f84
Files changed (2) hide show
  1. run_opencv.py +1 -1
  2. utils/frame_rate.py +1 -0
run_opencv.py CHANGED
@@ -85,7 +85,7 @@ num_skips = 0
85
  # define a video capture object
86
  vid = cv2.VideoCapture(0)
87
 
88
- while True:
89
  # Capture the video frame
90
  # by frame
91
  ret, frame = vid.read()
 
85
  # define a video capture object
86
  vid = cv2.VideoCapture(0)
87
 
88
+ while vid.isOpened():
89
  # Capture the video frame
90
  # by frame
91
  ret, frame = vid.read()
utils/frame_rate.py CHANGED
@@ -12,6 +12,7 @@ class FrameRate:
12
  self.NO_FRAMES = 10
13
  self.fps: float = -1
14
  self.label: str = ""
 
15
 
16
  def reset(self) -> None:
17
  self.start_time = time.time()
 
12
  self.NO_FRAMES = 10
13
  self.fps: float = -1
14
  self.label: str = ""
15
+ self.reset()
16
 
17
  def reset(self) -> None:
18
  self.start_time = time.time()