Copy original frame before resizing

This commit is contained in:
ABelliqueux 2025-03-21 14:07:41 +01:00
parent cbbc945821
commit b21a8d669c
1 changed files with 5 additions and 4 deletions

View File

@ -132,10 +132,10 @@ class webcam():
if not ret:
print(_("Failed to grab frame."))
return False
# Resize preview to fit screen
overlay = cv2.resize(overlay, (project_settings['screen_w'], project_settings['screen_h']))
# Keep original pic in memory
self.og_frame = overlay.copy()
# Resize preview to fit screen
overlay = cv2.resize(overlay, (project_settings['screen_w'], project_settings['screen_h']))
if self.liveview_only:
# Don't mix it
self.frame = overlay
@ -213,6 +213,7 @@ class webcam():
def flip_image(self):
self.frame = cv2.flip(self.frame, -1)
# Also flip original file
self.og_frame = cv2.flip(self.og_frame, -1)
def focus(self, direction:str='-'):
@ -329,10 +330,10 @@ class picam():
# Same as in webcam() class
def capture_preview(self):
overlay = self.cam.capture_array("main")
# Resize preview to fit screen
overlay = cv2.resize(overlay, (project_settings['screen_w'], project_settings['screen_h']))
# Keep original pic in memory
self.og_frame = overlay.copy()
# Resize preview to fit screen
overlay = cv2.resize(overlay, (project_settings['screen_w'], project_settings['screen_h']))
if self.liveview_only:
# Don't mix it
self.frame = overlay