diff --git a/EyeTrackApp/eye_processor.py b/EyeTrackApp/eye_processor.py index e814b05..90bbe9c 100644 --- a/EyeTrackApp/eye_processor.py +++ b/EyeTrackApp/eye_processor.py @@ -180,19 +180,23 @@ class EyeProcessor: self.one_euro_filter = OneEuroFilter(noisy_point, min_cutoff=min_cutoff, beta=beta) def output_images_and_update(self, threshold_image, output_information: EyeInfo): - try: - image_stack = np.concatenate( - ( - cv2.cvtColor(self.current_image_gray, cv2.COLOR_GRAY2BGR), - cv2.cvtColor(threshold_image, cv2.COLOR_GRAY2BGR), - ), - axis=1, - ) - self.image_queue_outgoing.put((image_stack, output_information)) - self.previous_image = self.current_image - self.previous_rotation = self.config.rotation_angle - except: # If this fails it likely means that the images are not the same size for some reason. - print("\033[91m[ERROR] Size of frames to display are of unequal sizes.\033[0m") + # try: + image_stack = np.concatenate( + ( + cv2.cvtColor(self.current_image_gray, cv2.COLOR_GRAY2BGR), + cv2.cvtColor(threshold_image, cv2.COLOR_GRAY2BGR), + ), + axis=1, + ) + self.image_queue_outgoing.put((image_stack, output_information)) + if self.image_queue_outgoing.qsize() > 3: + self.image_queue_outgoing.get() + + self.previous_image = self.current_image + self.previous_rotation = self.config.rotation_angle + + # except: # If this fails it likely means that the images are not the same size for some reason. + # print("\033[91m[ERROR] Size of frames to display are of unequal sizes.\033[0m") def capture_crop_rotate_image(self): # Get our current frame diff --git a/EyeTrackApp/eyetrackapp.py b/EyeTrackApp/eyetrackapp.py index 861019c..0de8641 100644 --- a/EyeTrackApp/eyetrackapp.py +++ b/EyeTrackApp/eyetrackapp.py @@ -245,7 +245,7 @@ def main(): except: print("\033[91m[INFO] Could not check for updates. Please try again later.\033[0m") - osc_queue: queue.Queue[OSCMessage] = queue.Queue() + osc_queue: queue.Queue[OSCMessage] = queue.Queue(maxsize=10) eyes = [ CameraWidget(EyeId.RIGHT, config, osc_queue),