Skip to content

Instantly share code, notes, and snippets.

@conanak99
Last active January 15, 2017 13:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save conanak99/dacd4559d405173970a8117126a230e6 to your computer and use it in GitHub Desktop.
Save conanak99/dacd4559d405173970a8117126a230e6 to your computer and use it in GitHub Desktop.
// Tìm khuôn mặt giống nhất trong Person Group (Face Recognition)
function identify(faceIds) {
console.log(`Begin to identity face.`);
let url = 'https://api.projectoxford.ai/face/v1.0/identify';
var res = request('POST', url, {
headers: {
'Ocp-Apim-Subscription-Key': key
},
json: {
"personGroupId": groupId,
"faceIds": faceIds,
"maxNumOfCandidatesReturned": 1,
}
});
if (res.statusCode == 200) {
console.log(`Finish identity face.`);
return JSON.parse(res.getBody('utf8'));
} else {
console.log('Error');
console.log(res.getBody('utf8'));
}
}
// Kết quả của hàm này
{
[
{
"faceId":"c5c24a82-6845-4031-9d5d-978df9175426",
"candidates":[
{
"personId":"25985303-c537-4467-b41d-bdb45cd95ca1",
"confidence":0.92
}
]
},
{
"faceId":"65d083d4-9447-47d1-af30-b626144bf0fb",
"candidates":[
{
"personId":"2ae4935b-9659-44c3-977f-61fac20d0538",
"confidence":0.89
}
]
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment