🔧 added captured frame window
This commit is contained in:
parent
d97d833308
commit
df40788db2
|
@ -28,7 +28,7 @@ while True:
|
||||||
pil_img = Image.fromarray(cv2.cvtColor(frame, cv2.COLOR_BGR2RGB))
|
pil_img = Image.fromarray(cv2.cvtColor(frame, cv2.COLOR_BGR2RGB))
|
||||||
|
|
||||||
# Resize the image
|
# Resize the image
|
||||||
max_size = 250
|
max_size = 350
|
||||||
ratio = max_size / max(pil_img.size)
|
ratio = max_size / max(pil_img.size)
|
||||||
new_size = tuple([int(x*ratio) for x in pil_img.size])
|
new_size = tuple([int(x*ratio) for x in pil_img.size])
|
||||||
resized_img = pil_img.resize(new_size, Image.LANCZOS)
|
resized_img = pil_img.resize(new_size, Image.LANCZOS)
|
||||||
|
@ -39,6 +39,13 @@ while True:
|
||||||
# Save the frame as an image file
|
# Save the frame as an image file
|
||||||
print("📸 Say cheese! Saving frame.")
|
print("📸 Say cheese! Saving frame.")
|
||||||
path = f"{folder}/frame.jpg"
|
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)
|
cv2.imwrite(path, frame)
|
||||||
else:
|
else:
|
||||||
print("Failed to capture image")
|
print("Failed to capture image")
|
||||||
|
|
Loading…
Reference in New Issue