-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathanalyzeFrame.py
28 lines (24 loc) · 1.06 KB
/
analyzeFrame.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#PDX-License-Identifier: MIT-0 (For details, see https://github.com/awsdocs/amazon-rekognition-developer-guide/blob/master/LICENSE-SAMPLECODE.)
import boto3
import json
import sys
def analyzeFrame(frame):
client=boto3.client('rekognition')
with open(frame, 'rb') as image:
response = client.recognize_celebrities(Image={'Bytes': image.read()})
print('Detected faces for ' + frame)
for celebrity in response['CelebrityFaces']:
print ('Name: ' + celebrity['Name'])
print ("Confidence: ", celebrity["MatchConfidence"])
print ('Id: ' + celebrity['Id'])
print ('Position:')
print (' Left: ' + '{:.2f}'.format(celebrity['Face']['BoundingBox']['Height']))
print (' Top: ' + '{:.2f}'.format(celebrity['Face']['BoundingBox']['Top']))
print ('Info')
for url in celebrity['Urls']:
print (' ' + url)
print("bye")
if __name__ == "__main__":
framePath=sys.argv[1]
analyzeFrame(framePath)