Skip to content

Instantly share code, notes, and snippets.

@AlexChesters
Created December 19, 2017 16:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AlexChesters/d5ab7dad69fd8ea158e58e93162c12a9 to your computer and use it in GitHub Desktop.
Save AlexChesters/d5ab7dad69fd8ea158e58e93162c12a9 to your computer and use it in GitHub Desktop.
import boto3
client = boto3.client(‘rekognition’, region_name=’eu-west-1')
def compare_faces(source_image_path, target_image_path):
source_image = open(source_image_path, ‘rb’)
target_image = open(target_image_path, ‘rb’)
response = client.compare_faces(
SourceImage={‘Bytes’: bytearray(source_image.read())},
TargetImage={‘Bytes’: bytearray(target_image.read())}
)
return response[‘FaceMatches’]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment