🔧 added captured frame window

This commit is contained in:
Paolo Pastore 2023-11-23 01:25:19 +01:00
parent d97d833308
commit df40788db2
1 changed files with 8 additions and 1 deletions

View File

@ -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")