Can I use Amazon Rekognition without an S3 bucket?

2019-07-30 01:52发布

问题:

I want to use the Firebase with the Amazon Rekognition is it possible to use?

I read Class for Rekognition for Node.js it has the S3 command in the code.

回答1:

No , you don't need to use s3 if you don't want. Using s3 provides low latency but you can use Rekognition services directly via API calls , the response of the API calls will contain your desired results in json format which you can use as you want.

Further if you use direct API calls , then you have to pass your images in base-64 encoded format while using REkognition API's.

Also you can use AWS SDK's for different programming languages which will make your task easier to use different AWS services easily.

e.g for detecting labels in python :

import boto3
from PIL import Image
import io
local='images/4.jpeg'
client = boto3.client('rekognition')
image = Image.open(local)

stream = io.BytesIO()
image.save(stream,format="JPEG")
image_binary = stream.getvalue()

response = client.detect_labels(
    Image={'Bytes':image_binary}
    )


print(response) 

while some rekognition services will require s3 to work.