I try to compare the two image which is in s3. So I have completed the code by referring to the following: https://docs.aws.amazon.com/ko_kr/rekognition/latest/dg/faces-comparefaces.html
I made the IdentityPool with Role(S3 Full Access, Rekognition Full Access).
try{
CompareFacesRequest compareFacesRequest = new CompareFacesRequest().
withSourceImage(new Image().withS3Object(new S3Object().withName(photo1).withBucket(bucket))).
withTargetImage(new Image().withS3Object(new S3Object().withName(photo2).withBucket(bucket))).withSimilarityThreshold(80F);
CompareFacesResult result = amazonRekognitionClient.compareFaces(compareFacesRequest);
List<CompareFacesMatch> list = result.getFaceMatches();
Log.d(TAG,"testing..");
if (!list.isEmpty()){
Log.d(TAG,"face match");
for (CompareFacesMatch match:list){
Log.d(TAG,match.getFace() + "" + match.getSimilarity());
}
}else{
Log.d(TAG,"face dismatch");
}
}catch (Exception e){
Log.d(TAG,"Exception occurs");
e.printStackTrace();
}
But it makes that error. com.amazonaws.services.rekognition.model.InvalidS3ObjectException: Unable to get object metadata from S3. Check object key, region and/or access permissions. (Service: AmazonRekognition; Status Code: 400; Error Code: InvalidS3ObjectException; Request ID: 2c4720e3-0e67-11e9-a286-7761b1c828e5)
I thought if I make a mistake of IAM, the app can't upload the file. I try to upload the file with same credentialsProvider, upload success.
I don't think that's what happened because of permission.
S3 region is in Seoul, and Cognito IdentityPool region is AP_NORTHEAST_2
is there any information to get s3 object with Rekognition?