Guest User

Untitled

a guest
Jun 21st, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.06 KB | None | 0 0
  1. <?php
  2. declare(strict_types=1);
  3.  
  4. namespace AppInfrastructure;
  5.  
  6. use AwsRekognitionRekognitionClient;
  7.  
  8. class MyComparator
  9. {
  10.  
  11. /**Credentials for access AWS Service code parameter*/
  12.  
  13. $credentials = new AwsCredentialsCredentials('{AWS access key ID}',
  14. '{AWS secret access key}');
  15.  
  16.  
  17. /**Get Rekognition Access*/
  18.  
  19. $rekognitionClient = RekognitionClient::factory(array(
  20. 'region' => "us-east-1",
  21. 'version' => 'latest',
  22. 'credentials' => $credentials
  23. ));
  24.  
  25.  
  26. /**Calling Compare Face function*/
  27.  
  28. $compareFaceResults= $rekognitionClient->compareFaces([
  29. 'SimilarityThreshold' => 1,
  30. 'SourceImage' => [
  31. 'Bytes' => file_get_contents("SourceImage.jpg")
  32. ],
  33. 'TargetImage' => [
  34. 'Bytes' => file_get_contents("TargetImage.jpg")
  35. ],
  36. ]);
  37.  
  38.  
  39. /**Response to JSON Data*/
  40.  
  41. $FaceMatchesResult = $compareFaceResults['FaceMatches'];
  42. $SimilarityResult = $FaceMatchesResult['Similarity'] //Here You will get similarity
  43. $sourceImageFace = $compareFaceResults['SourceImageFace']
  44. $sourceConfidence = $sourceImageFace['Confidence'] // //Here You will get confidence of the picture
Add Comment
Please, Sign In to add comment