From df40788db225fbe7ee416678456b44bb5c1bbdbb Mon Sep 17 00:00:00 2001 From: Paolo Pastore Date: Thu, 23 Nov 2023 01:25:19 +0100 Subject: [PATCH] :wrench: added captured frame window --- capture.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/capture.py b/capture.py index bc9845c..2350ccc 100644 --- a/capture.py +++ b/capture.py @@ -28,7 +28,7 @@ while True: pil_img = Image.fromarray(cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)) # Resize the image - max_size = 250 + max_size = 350 ratio = max_size / max(pil_img.size) new_size = tuple([int(x*ratio) for x in pil_img.size]) resized_img = pil_img.resize(new_size, Image.LANCZOS) @@ -39,6 +39,13 @@ while True: # Save the frame as an image file print("📸 Say cheese! Saving frame.") path = f"{folder}/frame.jpg" + + # Showing captured frame + cv2.imshow("image", frame) + # Keeps window open till the next cycle runs + cv2.waitKey(4900) + + # Writing frame on disk cv2.imwrite(path, frame) else: print("Failed to capture image")