fix: smaller resolution

This commit is contained in:
alban 2024-12-15 17:20:00 +01:00
parent 6d53b41df0
commit eec72dc87c

View File

@ -98,7 +98,7 @@ class OpenCVInterface:
self.create_slider(left_frame, var_name, var, min_val, max_val) self.create_slider(left_frame, var_name, var, min_val, max_val)
# Right Column: Image Placeholder # Right Column: Image Placeholder
self.image_canvas = tk.Canvas(self.root, bg="gray", width=1024, height=768) self.image_canvas = tk.Canvas(self.root, bg="gray", width=800, height=600)
self.image_canvas.grid(row=0, column=1, sticky="nswe") self.image_canvas.grid(row=0, column=1, sticky="nswe")
# Bottom Row: Run Button and Result # Bottom Row: Run Button and Result
@ -146,7 +146,7 @@ class OpenCVInterface:
pil_image = Image.fromarray(image) # Convert numpy array to PIL Image pil_image = Image.fromarray(image) # Convert numpy array to PIL Image
# Rescale image to fit within 1024x768 while preserving aspect ratio # Rescale image to fit within 1024x768 while preserving aspect ratio
max_width, max_height = 1024, 768 max_width, max_height = 800, 600
original_width, original_height = pil_image.size original_width, original_height = pil_image.size
aspect_ratio = min(max_width / original_width, max_height / original_height) aspect_ratio = min(max_width / original_width, max_height / original_height)
new_width = int(original_width * aspect_ratio) new_width = int(original_width * aspect_ratio)