reymesson1 / Programacion-Web-Avanzada

1 stars 0 forks source link

Massive check logic #27

Open reymesson1 opened 4 years ago

reymesson1 commented 4 years ago

//** //Show Items available in Bucket //** // var paramsBucket =3D { // Bucket: "rekognition-video-console-demo-iad-352250014224-1vio7fvwvq5qve", // MaxKeys: 2 // }; // s3.listObjects(paramsBucket, function(err, data) { // // s3.getObject(paramsBucket, function(err, data) { // if (err){ // console.log(err, err.stack); // an error occurred // }else{ // let scanningParameters =3D // { // TableName: 'orders', // "Item":{ // "id": ''+count+1, // "username" : "admin", // "quantity" : "1", // "project" : "123", // // "description": "AWS alexa " + event.image // "description": "" + JSON.stringify(data) // // "description": "" + event.operation // } // }

  //     docClient.put(scanningParameters,function(err,data)
  //     {
  //       if (err) {
  //         callback(err,null,);
  //       }
  //       else {
  //         callback(null, data);
  //       }

  //     });
  //     console.log(data);           // successful response
  //   }

    /*
    data =3D {
      AcceptRanges: "bytes",
      ContentLength: 3191,
      ContentType: "image/jpeg",
      ETag: "\"6805f2cfc46c0f04559748bb039d69ae\"",
      LastModified: <Date Representation>,
      Metadata: {
      },
      TagCount: 2,
      VersionId: "null"
    }
    */
  // });
reymesson1 commented 4 years ago
////*************************************
//working fine - comparefaces from mobile
////*************************************

  var params = {
    SourceImage: {
      S3Object: {
        Bucket: "rekognition-video-console-demo-iad-352250014224-1vio7fvwvq5qve", 
        // Name: "amazon-ceo-jeff-bezos_2.jpg"
        Name: "PUCMM2.JPG"
      }
      //Bytes: buffer
      // Video: buffer
    },
    TargetImage: {
      // Bytes: buffer2
      S3Object: {
        Bucket: "webpaa-deployments-mobilehub-2128298286", 
        // Name: "amazon-ceo-jeff-bezos_2.jpg"
        Name: "PUCMM.jpg"
        // Name: "getty_946964370_200013332000928085_381902.jpg"
      }
    },
    SimilarityThreshold: 0,
  };
//   // var params = {
//   //   Image: {
//   //     Bytes: buffer2
//   //   },
//   //   Attributes: [
//   //     'ALL',
//   //   ]
//   // };

//   // rekognition.detectFaces(params, async (err, data) =>{
  rekognition.compareFaces(params, async (err, data) =>{
    table = "<table><tr><th>Low</th><th>High</th></tr>";
    if (err){
      table += "</tablee>";
      console.log(err, err.stack); // an error occurred
    }
    else {

//       // show each face and build out estimated age table
      // for (var i = 0; i < data.FaceDetails.length; i++) {
      for (var i = 0; i < data.FaceMatches.length; i++) {
        table += '<tr><td>' + data.FaceMatches[i].Similarity + '</td></tr>';
      }
      table += "</table><br/>"
      // table = JSON.stringify(data)
//       document.getElementById("opResult").innerHTML = table;

    }
});
reymesson1 commented 4 years ago

for (var i = 0; i < data.FaceMatches.length; i++) { table += '' + data.FaceMatches[i].Similarity + ''; }