Last active
January 15, 2017 13:13
-
-
Save conanak99/dacd4559d405173970a8117126a230e6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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