diff --git a/crabs/tracker/track_video.py b/crabs/tracker/track_video.py index 623f1435..b6e9bb1c 100644 --- a/crabs/tracker/track_video.py +++ b/crabs/tracker/track_video.py @@ -236,6 +236,13 @@ def core_detection_and_tracking(self): # Loop over frames frame_idx = 0 while input_video_object.isOpened(): + # Break if beyond end frame (mostly for debugging) + if ( + self.args.max_frames_to_read + and frame_idx + 1 > self.args.max_frames_to_read + ): + break + # Read frame ret, frame = input_video_object.read() if not ret: