This AWS Lambda function is triggered by a new object created in an S3 bucket. The function takes the image from the S3 bucket, analyzes it using OpenCV to determine an estimated time of day based on visual characteristics of the image, and compares that with the time information in the EXIF data.
- AWS Account
- Python 3.x
- OpenCV (
cv2
) - NumPy (
numpy
) - Boto3 (
boto3
) - Pillow (
PIL
) - Temporary File System Access (
tempfile
) - Datetime (
datetime
)
The required Python packages are listed in the requirements.txt
file and can be installed using pip:
```bash pip install -r requirements.txt ```
The Lambda function is designed to be triggered by an event in S3, specifically when a new object (image) is created.
The function uses Boto3 to download the image from the S3 bucket to a temporary file.
Pillow (PIL) is used to read the EXIF data from the image, which contains the timestamp indicating when the photo was taken. This time is classified into one of the following periods:
- Morning
- Day
- Evening
- Night
The function returns a JSON object containing both the estimated time of day based on visual characteristics and the actual time of day based on the EXIF data.
A github action handles deployment