fix: gui off mem leak, frame buildup

This commit is contained in:
Prohurtz 2024-07-30 15:39:43 -05:00
parent e927fd25ce
commit df29fc0380
2 changed files with 18 additions and 14 deletions

View File

@ -180,19 +180,23 @@ class EyeProcessor:
self.one_euro_filter = OneEuroFilter(noisy_point, min_cutoff=min_cutoff, beta=beta) self.one_euro_filter = OneEuroFilter(noisy_point, min_cutoff=min_cutoff, beta=beta)
def output_images_and_update(self, threshold_image, output_information: EyeInfo): def output_images_and_update(self, threshold_image, output_information: EyeInfo):
try: # try:
image_stack = np.concatenate( image_stack = np.concatenate(
( (
cv2.cvtColor(self.current_image_gray, cv2.COLOR_GRAY2BGR), cv2.cvtColor(self.current_image_gray, cv2.COLOR_GRAY2BGR),
cv2.cvtColor(threshold_image, cv2.COLOR_GRAY2BGR), cv2.cvtColor(threshold_image, cv2.COLOR_GRAY2BGR),
), ),
axis=1, axis=1,
) )
self.image_queue_outgoing.put((image_stack, output_information)) self.image_queue_outgoing.put((image_stack, output_information))
self.previous_image = self.current_image if self.image_queue_outgoing.qsize() > 3:
self.previous_rotation = self.config.rotation_angle self.image_queue_outgoing.get()
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") 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): def capture_crop_rotate_image(self):
# Get our current frame # Get our current frame

View File

@ -245,7 +245,7 @@ def main():
except: except:
print("\033[91m[INFO] Could not check for updates. Please try again later.\033[0m") 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 = [ eyes = [
CameraWidget(EyeId.RIGHT, config, osc_queue), CameraWidget(EyeId.RIGHT, config, osc_queue),