19 lines
351 B
Python
19 lines
351 B
Python
import datetime
|
|
|
|
import cv2
|
|
import boto3
|
|
|
|
BUCKET = ""
|
|
FORMAT = "jpg"
|
|
|
|
cam = cv2.VideoCapture(0)
|
|
s3 = boto3.client('s3')
|
|
|
|
ret, frame = cam.read()
|
|
ret, img = cv2.imencode(FORMAT, frame)
|
|
|
|
response = s3.put_object(
|
|
Body=img.tobytes(),
|
|
Bucket=BUCKET,
|
|
Key=datetime.datetime.strftime(datetime.datetime.now(), "%Y-%m-%d-%H-%M-%S") + "." + FORMAT
|
|
) |