Rekognition: Empty Result
Hey Stackers.
I'm trying to use Rekognition via the AWS PHP SDK. I do, however have a problem with it. After a long time trying to figure out what's wrong and I still haven't figured it out. I'm making a request as follows;
$returnData = new stdClass();
$this->rekognition = new RekognitionClient([
'version' => 'latest',
'region' => 'eu-west-1',
'credentials' => [
'key' => 'XXXX',
'secret' => 'XXXX'
]
]);
try {
$this->basePrint = $basePrint;
$this->newPrint = $newPrint;
$faceAnalysis = $this->rekognition->compareFaces([
'SourceImage' => [
'Bytes' => base64_decode($this->basePrint),
],
'TargetImage' => [
'Bytes' => base64_decode($this->newPrint),
],
'Attributes' => ['all']
]);
$returnData->state = "success";
$returnData->matchResult = $faceAnalysis;
} catch (RekognitionException $e){
$returnData->state = "error";
$returnData->AwsErrorCode = $e->getAwsErrorCode();
$returnData->AwsErrorMessage = $e->getAwsErrorMessage();
$returnData->OriginalPrint = $this->basePrint;
$returnData->NewPrint = $this->newPrint;
}
return $returnData;
That's all fine. No excepton is thrown. However, the result of $faceAnalysis
is empty. It is null. Without any error thrown. I looked it up in the documentation, and I can't find anything that would result is this behaviour.
Am I doing something wrong or am I missing something?
amazon-web-services amazon-rekognition
add a comment |
Hey Stackers.
I'm trying to use Rekognition via the AWS PHP SDK. I do, however have a problem with it. After a long time trying to figure out what's wrong and I still haven't figured it out. I'm making a request as follows;
$returnData = new stdClass();
$this->rekognition = new RekognitionClient([
'version' => 'latest',
'region' => 'eu-west-1',
'credentials' => [
'key' => 'XXXX',
'secret' => 'XXXX'
]
]);
try {
$this->basePrint = $basePrint;
$this->newPrint = $newPrint;
$faceAnalysis = $this->rekognition->compareFaces([
'SourceImage' => [
'Bytes' => base64_decode($this->basePrint),
],
'TargetImage' => [
'Bytes' => base64_decode($this->newPrint),
],
'Attributes' => ['all']
]);
$returnData->state = "success";
$returnData->matchResult = $faceAnalysis;
} catch (RekognitionException $e){
$returnData->state = "error";
$returnData->AwsErrorCode = $e->getAwsErrorCode();
$returnData->AwsErrorMessage = $e->getAwsErrorMessage();
$returnData->OriginalPrint = $this->basePrint;
$returnData->NewPrint = $this->newPrint;
}
return $returnData;
That's all fine. No excepton is thrown. However, the result of $faceAnalysis
is empty. It is null. Without any error thrown. I looked it up in the documentation, and I can't find anything that would result is this behaviour.
Am I doing something wrong or am I missing something?
amazon-web-services amazon-rekognition
You pass the input and target images as base64-encoded image bytes (or as references to images in an Amazon S3 bucket).
– jarmod
Nov 12 at 20:37
@jarmod That's how I had it at first. However, since my variables$this->basePrint
and$this->newPrint
come from a Data URL I need to decode them first. AWS will encode them. Otherwise it will return a InvalidImageFormatException.
– Synthiatic
Nov 12 at 20:45
I'd be tempted to perform the same test with these two images using the awscli. What does it report?
– jarmod
Nov 12 at 21:42
add a comment |
Hey Stackers.
I'm trying to use Rekognition via the AWS PHP SDK. I do, however have a problem with it. After a long time trying to figure out what's wrong and I still haven't figured it out. I'm making a request as follows;
$returnData = new stdClass();
$this->rekognition = new RekognitionClient([
'version' => 'latest',
'region' => 'eu-west-1',
'credentials' => [
'key' => 'XXXX',
'secret' => 'XXXX'
]
]);
try {
$this->basePrint = $basePrint;
$this->newPrint = $newPrint;
$faceAnalysis = $this->rekognition->compareFaces([
'SourceImage' => [
'Bytes' => base64_decode($this->basePrint),
],
'TargetImage' => [
'Bytes' => base64_decode($this->newPrint),
],
'Attributes' => ['all']
]);
$returnData->state = "success";
$returnData->matchResult = $faceAnalysis;
} catch (RekognitionException $e){
$returnData->state = "error";
$returnData->AwsErrorCode = $e->getAwsErrorCode();
$returnData->AwsErrorMessage = $e->getAwsErrorMessage();
$returnData->OriginalPrint = $this->basePrint;
$returnData->NewPrint = $this->newPrint;
}
return $returnData;
That's all fine. No excepton is thrown. However, the result of $faceAnalysis
is empty. It is null. Without any error thrown. I looked it up in the documentation, and I can't find anything that would result is this behaviour.
Am I doing something wrong or am I missing something?
amazon-web-services amazon-rekognition
Hey Stackers.
I'm trying to use Rekognition via the AWS PHP SDK. I do, however have a problem with it. After a long time trying to figure out what's wrong and I still haven't figured it out. I'm making a request as follows;
$returnData = new stdClass();
$this->rekognition = new RekognitionClient([
'version' => 'latest',
'region' => 'eu-west-1',
'credentials' => [
'key' => 'XXXX',
'secret' => 'XXXX'
]
]);
try {
$this->basePrint = $basePrint;
$this->newPrint = $newPrint;
$faceAnalysis = $this->rekognition->compareFaces([
'SourceImage' => [
'Bytes' => base64_decode($this->basePrint),
],
'TargetImage' => [
'Bytes' => base64_decode($this->newPrint),
],
'Attributes' => ['all']
]);
$returnData->state = "success";
$returnData->matchResult = $faceAnalysis;
} catch (RekognitionException $e){
$returnData->state = "error";
$returnData->AwsErrorCode = $e->getAwsErrorCode();
$returnData->AwsErrorMessage = $e->getAwsErrorMessage();
$returnData->OriginalPrint = $this->basePrint;
$returnData->NewPrint = $this->newPrint;
}
return $returnData;
That's all fine. No excepton is thrown. However, the result of $faceAnalysis
is empty. It is null. Without any error thrown. I looked it up in the documentation, and I can't find anything that would result is this behaviour.
Am I doing something wrong or am I missing something?
amazon-web-services amazon-rekognition
amazon-web-services amazon-rekognition
asked Nov 12 at 20:11
Synthiatic
11612
11612
You pass the input and target images as base64-encoded image bytes (or as references to images in an Amazon S3 bucket).
– jarmod
Nov 12 at 20:37
@jarmod That's how I had it at first. However, since my variables$this->basePrint
and$this->newPrint
come from a Data URL I need to decode them first. AWS will encode them. Otherwise it will return a InvalidImageFormatException.
– Synthiatic
Nov 12 at 20:45
I'd be tempted to perform the same test with these two images using the awscli. What does it report?
– jarmod
Nov 12 at 21:42
add a comment |
You pass the input and target images as base64-encoded image bytes (or as references to images in an Amazon S3 bucket).
– jarmod
Nov 12 at 20:37
@jarmod That's how I had it at first. However, since my variables$this->basePrint
and$this->newPrint
come from a Data URL I need to decode them first. AWS will encode them. Otherwise it will return a InvalidImageFormatException.
– Synthiatic
Nov 12 at 20:45
I'd be tempted to perform the same test with these two images using the awscli. What does it report?
– jarmod
Nov 12 at 21:42
You pass the input and target images as base64-encoded image bytes (or as references to images in an Amazon S3 bucket).
– jarmod
Nov 12 at 20:37
You pass the input and target images as base64-encoded image bytes (or as references to images in an Amazon S3 bucket).
– jarmod
Nov 12 at 20:37
@jarmod That's how I had it at first. However, since my variables
$this->basePrint
and $this->newPrint
come from a Data URL I need to decode them first. AWS will encode them. Otherwise it will return a InvalidImageFormatException.– Synthiatic
Nov 12 at 20:45
@jarmod That's how I had it at first. However, since my variables
$this->basePrint
and $this->newPrint
come from a Data URL I need to decode them first. AWS will encode them. Otherwise it will return a InvalidImageFormatException.– Synthiatic
Nov 12 at 20:45
I'd be tempted to perform the same test with these two images using the awscli. What does it report?
– jarmod
Nov 12 at 21:42
I'd be tempted to perform the same test with these two images using the awscli. What does it report?
– jarmod
Nov 12 at 21:42
add a comment |
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53269405%2frekognition-empty-result%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53269405%2frekognition-empty-result%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
You pass the input and target images as base64-encoded image bytes (or as references to images in an Amazon S3 bucket).
– jarmod
Nov 12 at 20:37
@jarmod That's how I had it at first. However, since my variables
$this->basePrint
and$this->newPrint
come from a Data URL I need to decode them first. AWS will encode them. Otherwise it will return a InvalidImageFormatException.– Synthiatic
Nov 12 at 20:45
I'd be tempted to perform the same test with these two images using the awscli. What does it report?
– jarmod
Nov 12 at 21:42