Skip to content

Instantly share code, notes, and snippets.

@conanak99
Created January 15, 2017 13:14
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/14ce075cc7d0bfec4c8491eff9313ae8 to your computer and use it in GitHub Desktop.
Save conanak99/14ce075cc7d0bfec4c8491eff9313ae8 to your computer and use it in GitHub Desktop.
// Phát hiện khuôn mặt trong ảnh (Face Detection)
function detect(imageUrl) {
console.log(`Begin to detect face from image: ${imageUrl}`);
let url = `https://api.projectoxford.ai/face/v1.0/detect`;
var res = request('POST', url, {
headers: {
'Ocp-Apim-Subscription-Key': key
},
json: {
url: imageUrl
}
});
if (res.statusCode == 200) {
var result = JSON.parse(res.getBody('utf8'));
console.log(`Found ${result.length} faces.`);
return result;
}
}
// Kết quả của hàm
[
{
"faceId": "c5c24a82-6845-4031-9d5d-978df9175426",
"faceRectangle": {
"width": 78,
"height": 78,
"left": 394,
"top": 54
}
}
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment