Face API 可以偵測影像上人臉的資訊,並回傳一些臉部位置、年齡、性別...等等的強大的雲端服務。
很就快就建立好了,下面是部署資訊。
取得 Face API 要打的 URL
取得 Face API 的 Key
接著呢! 我找了文件中寫好的 javacript 叫用 Face API 的範例。
快速入門:使用 REST API 和 JavaScript 偵測影像中的人臉
最後就可以跑起來了,我們就可以填入照片的 URL 並分析照片上的人臉。 (我自己是把圖片跟網頁都放在blob中)
這是 Face API 回應回來的人臉資訊。
[
{
"faceId": "c2d31932-055f-43c8-81c2-fcfb1616f469",
"faceRectangle": {
"top": 419,
"left": 775,
"width": 278,
"height": 278
},
"faceAttributes": {
"smile": 0,
"headPose": {
"pitch": 0,
"roll": 31.7,
"yaw": -20.8
},
"gender": "female",
"age": 20,
"facialHair": {
"moustache": 0,
"beard": 0,
"sideburns": 0
},
"glasses": "NoGlasses",
"emotion": {
"anger": 0,
"contempt": 0,
"disgust": 0,
"fear": 0,
"happiness": 0,
"neutral": 0.977,
"sadness": 0.001,
"surprise": 0.021
},
"blur": {
"blurLevel": "low",
"value": 0
},
"exposure": {
"exposureLevel": "goodExposure",
"value": 0.59
},
"noise": {
"noiseLevel": "low",
"value": 0
},
"makeup": {
"eyeMakeup": true,
"lipMakeup": true
},
"accessories": [],
"occlusion": {
"foreheadOccluded": false,
"eyeOccluded": false,
"mouthOccluded": false
},
"hair": {
"bald": 0.05,
"invisible": false,
"hairColor": [
{
"color": "brown",
"confidence": 1
},
{
"color": "black",
"confidence": 0.59
},
{
"color": "red",
"confidence": 0.36
},
{
"color": "blond",
"confidence": 0.27
},
{
"color": "gray",
"confidence": 0.11
},
{
"color": "other",
"confidence": 0.07
}
]
}
}
}
]