Skip to content
Advertisement

How to read image from S3 using OpenCV (cv2.imread)?

I am having trouble reading images from the S3 bucket. I can read images locally like that.

JavaScript

But I have no idea why S3 said error

JavaScript

Advertisement

Answer

You need to first establish a connection to S3, then download the image data, and finally decode the data with OpenCV.

For the first bit (connecting to S3), Boto3 is a good alternative (it’s the Python SDK for AWS).

Full sample code:

JavaScript
User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement