2

Iam doing a project with nodejs and aws.

I am using WebRTC and taking photo.

After i am taking photos base64 data and posting nodejs and i am putting it my aws console and i am using it for detectfaces but its giving error.

But i am adding photo from my aws console manually detect faces not giving a error.

My codes here : MY WEBCAM JS : this is giving a base64 for me.

> drawImage(video, 0, 0, canvas.width, canvas.height);
>      var data = canvas.toDataURL('image/jpeg');
>       photo.setAttribute('src', data);
>       console.log(data);

and i am trying post with POSTMAN CHROME EXTENSION to my nodejs i can put it well but i can't using a detect faces.

My nodejs :

app.post('/addPhoto', function (req, res) {
 var base64data=new Buffer(req.body.photo.replace(/^data:image\/\w+;base64,/, ""),'base64');
console.log(base64data);
  var params = {Bucket:  "realeyeshomework", Key:"111111111.jpg", Body: base64data};
   s3.putObject(params, function(err, data) {
     if (err)
       console.log(err)
     else{
       console.log("1");

       rekognition.detectFaces( {
 Image: {
        S3Object: {
        Bucket: "realeyeshomework",
        Name:"111111111.jpg"
        }
      },
 Attributes: [
    "ALL"
  ]
}, function(error, response) {
        if (error) console.log(error, error.stack); // an error occurred
        else  res.send(response);
    });
     }
   });
});

MY ERROR : CLICK HERE FOR ERROR

How can i do this please help me i could not fint anything.

Thanks for help.

Okan
  • 58
  • 5
  • Its giving a error like : message: 'Request has Invalid Parameters', code: 'InvalidParameterException', – Okan Mar 28 '17 at 12:49

2 Answers2

1

The issue will be with the image. I was facing exactly the same issue but ultimately I found that the image I was using was corrupted. The image was opening correctly in MSPaint but was not being recognized by AWS Rekognition. Try uploading the image directly into the AWS Rekognition console and you will ifnd the same error. More details on this thread : AWS Rekognition Error - InvalidparameterException

Sourabh Jain
  • 628
  • 6
  • 20
0

you set ?

var rekognition = new AWS.Rekognition({apiVersion: '2016-06-27'});

try watch Examples Code

aofdev
  • 1,772
  • 1
  • 15
  • 29
  • I am also facing same issue . Please let me know what sould be the issue. More details can be found here https://stackoverflow.com/questions/48115069/aws-rekognition-error-invalidparameterexception – Sourabh Jain Jan 05 '18 at 15:00