Created
January 15, 2017 13:14
-
-
Save conanak99/14ce075cc7d0bfec4c8491eff9313ae8 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
// 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