我正在尝试将 Amazon Rekognition 服务与 Node.js 一起使用,
我使用示例程序将人脸图像上传到存储桶中的 S3 服务,现在我想使用 Node.js 检测人脸
代码如下
// Load the AWS SDK for Node.js
var AWS = require('aws-sdk');
// Load credentials and set region from JSON file
AWS.config.loadFromPath('./config.json');
var rekognition = new AWS.Rekognition({apiVersion: '2016-06-27'});
var s3 = new AWS.S3({apiVersion: '2006-03-01'});
/* 此操作检测存储在 AWS S3 存储桶中的图像中的人脸。*/
var params = {
Image: {
S3Object: {
Bucket: "rekognitionfortesting",
Name: "face1.jpeg"
}
},
};
rekognition.detectFaces(params, function(err, data) {
if (err) console.log(err, err.stack); // an error occurred
else console.log(data); // successful response
});
我无法获得真实数据,这是我得到的回复:
[对象] 已写入。通常它应该给出如下响应。
data = {
FaceDetails: [
{
BoundingBox: {
Height: 0.18000000715255737,
Left: 0.5555555820465088,
Top: 0.33666667342185974,
Width: 0.23999999463558197
},
Confidence: 100,
Landmarks: [
{
Type: "EYE_LEFT",
X: 0.6394737362861633,
Y: 0.40819624066352844
},
{
Type: "EYE_RIGHT",
X: 0.7266660928726196,
Y: 0.41039225459098816
},
{
Type: "NOSE_LEFT",
X: 0.6912462115287781,
Y: 0.44240960478782654
},
{
Type: "MOUTH_DOWN",
X: 0.6306198239326477,
Y: 0.46700039505958557
},
{
Type: "MOUTH_UP",
X: 0.7215608954429626,
Y: 0.47114261984825134
}
],
Pose: {
Pitch: 4.050806522369385,
Roll: 0.9950747489929199,
Yaw: 13.693790435791016
},
Quality: {
Brightness: 37.60169982910156,
Sharpness: 80
}
}
],
OrientationCorrection: "ROTATE_0"
}
*/
});
如何获取人脸数据?