Google人臉辨識

Picasa  是一套由Google開發且提供免費使用的相片編輯與檢視圖片的管理軟體,除了可以為圖片建立索引來管理自身電腦內的圖片,更可結合網路相簿的功能(「Picasa 網路相簿」提供 1 GB 的免費儲存空間,若想取得網路相簿中所有相片的外部URL連結可參考PicasaWebUtility 線上下載Google Picasa網路相簿及產生所有相片連結網址 ),輕鬆的建立線上相簿分享親朋好友之外,在後續推出的Picasa新版本中更加入了,可根據相片中人物自動整理相片的「人臉辨識」及使用名稱標記來協助圖片進行「自動分類」的功能,讓程式將內含有同一個人臉的相片依名稱來自動分類,方便我們快速找到相片。

Picasa 軟體檔案

  • 軟體版本:3.8
  • 軟體語言:繁體中文(多國語言)
  • 軟體性質:免費
  • 系統支援:Windows XP/Vista/7
  • 官方網站:按我前往 Picasa
  • 軟體下載:按我下載

 訂閱關鍵應用,軟體應用技巧再升級 

如何使用 Picasa ?

將這篇文章快速佈署到你的網站

安裝Picasa注意事項:

下載後並執行安裝,安裝程序的最後有幾個選項,可以依需要進行勾選。




如何使用Picasa:

1.安裝完成後,第一次開啟Picasa 主程式時,會先出現一個對話框來詢問你要掃描的圖片範圍,若不想搜尋整個電腦,可選擇第一個選項來指定要搜尋的路徑及資料夾,選擇好之後,點擊[繼續]。


2.接下來是選擇圖檔格式的關連,設定哪些圖檔格式,預設使用Picasa來開啟或不使用Picasa,建議可以全部勾選,選擇好之後,點擊[完成]就會開始掃描。


3.掃描的進度會顯示在左邊分格欄,並會依照日期列出所有掃描到含有相片和影片的資料夾,右邊則是將所有的相片依照資料夾,全部整合成一頁顯示出來,讓你不必去逐一點選資料夾來看圖了。


4.此時若要放大檢視圖片,可選擇[播放]以投影片的方式全螢幕檢視,下圖紅色框內有三個按鈕,由左至右依序為[播放]、[建立美術拼貼]及[建立電影放映],實在好用。


5.若想上傳到網路相簿,點擊下方按鈕[上載],輸入你在Google的帳戶,便可上傳。


6.若想對圖片進行編輯,滑鼠選中欲編輯的圖片,並雙擊滑鼠左鍵,便會出現可編輯的功能表。



 如何使用Picasa的「人臉辨識」:

1.首先必須建立新的「人物相簿」,在右邊的相片中挑選要建立的人物相片後,點擊左側[人物],Picasa便會將人臉相片中的人臉辨識出並顯示在右側列表,此時都是屬於無名人物,此時挑選人臉,並給予一個「名稱標記」。


2.輸入「名稱標記」後,按下鍵盤的[Enter]鍵,接下來會出現「人物」的設定視窗,點擊[新人物]並輸入必要資訊後,點擊[確定]關閉設定視窗。


3.此時Picasa程式,會搜尋所有圖片找出相似的人臉,並顯示在相片列表中,如果有漏掉的話,我們也可以手動把照片拉到該分類中。分類好之後,我們可以從左上角的名稱標記點選、瀏覽同一個人的照片。




4.當我們以「人臉」檢視相片時,右上角會有個[放大檢視臉孔]或[縮小檢視整張圖片]的選項可以點擊,已協助我們檢視這個臉孔是出現在哪一張照片中。

Google相簿以免費備份無限量的相片和影片服務作為智慧型手機用戶選擇雲端相簿的首選,不過這不代表它沒有缺點。用戶多年來數次要求Google在Google相簿中添增手動增加人臉標記功能未果,但在稍早前的更新中,這項功能已悄悄上線了。

此功能是Google為用戶在人臉標記上提供更多控制權,簡單來說,就是用戶能在相片中自行添增人臉標記,這是一項巨大優勢,用戶能透過手動方式為相片中的人物加上標記,一方面能改正標記錯誤的問題,另一方面也能提升自動標記的精準度。不過其中仍不乏一些限制。

據科技網站Android Police報導,此功能仍是依靠Google的臉部辨識演算法來執行的,也就是說,若Google無法在照片中偵測到「人臉」則無法添增標記,因此,若照片中人物臉部輪廓不清晰或為臉部側面致使系統無法識別出人臉,即無法為其添增標記。

若Google檢測到系統存在人臉,則用戶可將人臉連接至已添增的人物資料中,也可創建新的標籤並標記於照片中的人臉。此外,除了可添增人臉標籤,也可刪除系統自行記錄的人臉標籤,此功能在人物眾多的照片上相當有用。

帶您認識一下時下最夯的人臉識別技術,一個專供手機使用的多因子認證器「BioID App」! 無須複雜繁瑣的程式設計,現在的開發商以及企業界,隨時即可將人臉識別融入其行動服務平台,讓使用者可以更安全輕鬆地登入網路帳戶,或授權網路交易。 告別密碼,就靠人臉!

採用行動人臉識別的快捷多因子認證

為何採用生物識別?

密碼被盜用已是現今每週的頭條新聞:眾所週知,單一密碼是無法保障安全的。即使採用冗長複雜的密碼, 想在手機輸入,卻又極其惱人不便 。於是採用軟體或硬體的多因子認證系統,因而日愈普及。

如同人臉識別的生物識別技術,無須特殊硬體,僅用手機,即可確認使用者的存在,是個快捷安全的多因子認證。

BioID App對我有什麼用?

BioID App提供多因子的使用者認證:生物識別+手機。這是以BioID Web Service(BWS)為基礎的使用者身份服務「BioID Connect」在手機端的軟體介面。BioID Connect是沿用我公司「活體偵測」專利設計,全面支援OpenID Connect,以及OAuth 2.0的「生物識別為服務」。

在手機開啟4.32測試版的「Google相簿」應用程式後,頂部搜尋列的最右側,會出現用戶登入個人Google相簿帳號的個人照片,直接點選照片後,介面即會顯示帳號列表清單,並可快速切換不同的帳號名稱進行相簿瀏覽。運作方式跟 Google Gmail、Google Drive雲端硬碟的帳號切換介面相同。

當瀏覽任何包含人物或寵物的照片時,在螢幕的右上角點按「…」圖示後,除了可查看該張照片的拍攝日期時間,顯示該照片所拍攝的位置外,現時還新增了一項可讓用戶手動編輯自訂照片人臉標籤的功能。考慮到之前的限制,Google手動標記僅會在圖片中成功檢測到人臉時,才可以進行編輯,命名或添加新標籤。

  • 首页
  • Cloud Vision API
  • 文档
  • 指南

发送反馈检测人脸使用集合让一切井井有条 根据您的偏好保存内容并对其进行分类。

人脸检测功能可以检测图片中的多张人脸,以及相关的主要面部特征,如情绪状态或有无 curl -X POST \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "x-goog-user-project: PROJECT_ID" \
-H "Content-Type: application/json; charset=utf-8" \
-d @request.json \
"//vision.googleapis.com/v1/images:annotate"1。

不支持特定个人面部识别。

注意:Vision API 现在支持将离线异步批量图片注释用于所有特征。此异步请求支持多达 2,000 个图片文件,并返回存储在您的 Cloud Storage 存储桶中的响应 JSON 文件。如需详细了解此功能,请参阅离线批量图片注释。注意:Vision 现在提供名人识别功能,不过处于受限 Beta 版阶段,您可以申请将这项功能添加到您的项目中。如需了解详情,请参阅名人识别主题。

自行试用

如果您是 Google Cloud 新手,请创建一个帐号来评估 Cloud Vision API 在实际场景中的表现。新客户还可获享 $300 赠金,用于运行、测试和部署工作负载。

免费试用 Cloud Vision API

人脸检测请求

设置您的 Google Cloud 项目和身份验证

如果您尚未创建 Google Cloud 项目,请立即创建。展开本部分可查看相关说明。

  1. 登录您的 Google Cloud 帐号。如果您是 Google Cloud 新手,请创建一个帐号来评估我们的产品在实际场景中的表现。新客户还可获享 $300 赠金,用于运行、测试和部署工作负载。
  2. 在 Google Cloud Console 中的项目选择器页面上,选择或创建一个 Google Cloud 项目。

    注意:如果您不打算保留在此过程中创建的资源,请创建新的项目,而不要选择现有的项目。完成本教程介绍的步骤后,您可以删除所创建的项目,并移除与该项目关联的所有资源。

    转到“项目选择器”

  3. 确保您的 Cloud 项目已启用结算功能。了解如何检查项目是否已启用结算功能。

  4. 启用 Vision API。

    启用 API

  5. 安装并初始化 Google Cloud CLI。
  6. 在 Google Cloud Console 中的项目选择器页面上,选择或创建一个 Google Cloud 项目。

    注意:如果您不打算保留在此过程中创建的资源,请创建新的项目,而不要选择现有的项目。完成本教程介绍的步骤后,您可以删除所创建的项目,并移除与该项目关联的所有资源。

    转到“项目选择器”

  7. 确保您的 Cloud 项目已启用结算功能。了解如何检查项目是否已启用结算功能。

  8. 启用 Vision API。

    启用 API

  9. 安装并初始化 Google Cloud CLI。

检测本地图片中的人脸

Vision API 可以将本地图片文件的内容作为 base64 编码的字符串在请求正文中发送,从而对此图片文件执行特征检测。

REST

在使用任何请求数据之前,请先进行以下替换:

  • BASE64_ENCODED_IMAGE:二进制图片数据的 base64 表示(ASCII 字符串)。此字符串应类似于以下字符串:
    • curl -X POST \
      -H "Authorization: Bearer $(gcloud auth print-access-token)" \
      -H "x-goog-user-project: PROJECT_ID" \
      -H "Content-Type: application/json; charset=utf-8" \
      -d @request.json \
      "//vision.googleapis.com/v1/images:annotate"2
    如需了解详情,请参阅 base64 编码主题。
  • RESULTS_INT:(可选)要返回的结果的整数值。如果您省略 curl -X POST \
    -H "Authorization: Bearer $(gcloud auth print-access-token)" \
    -H "x-goog-user-project: PROJECT_ID" \
    -H "Content-Type: application/json; charset=utf-8" \
    -d @request.json \
    "//vision.googleapis.com/v1/images:annotate"3 字段及其值,则 API 会默认返回 10 个结果。此字段不适用于以下功能类型:curl -X POST \
    -H "Authorization: Bearer $(gcloud auth print-access-token)" \
    -H "x-goog-user-project: PROJECT_ID" \
    -H "Content-Type: application/json; charset=utf-8" \
    -d @request.json \
    "//vision.googleapis.com/v1/images:annotate"4、curl -X POST \
    -H "Authorization: Bearer $(gcloud auth print-access-token)" \
    -H "x-goog-user-project: PROJECT_ID" \
    -H "Content-Type: application/json; charset=utf-8" \
    -d @request.json \
    "//vision.googleapis.com/v1/images:annotate"5 或 curl -X POST \
    -H "Authorization: Bearer $(gcloud auth print-access-token)" \
    -H "x-goog-user-project: PROJECT_ID" \
    -H "Content-Type: application/json; charset=utf-8" \
    -d @request.json \
    "//vision.googleapis.com/v1/images:annotate"6。
  • PROJECT_ID:您的 Google Cloud 项目 ID。

HTTP 方法和网址:

POST //vision.googleapis.com/v1/images:annotate

请求 JSON 正文:

{ "requests": [ { "image": { "content": "BASE64_ENCODED_IMAGE" }, "features": [ { "maxResults": RESULTS_INT, "type": "FACE_DETECTION" } ] } ] }

如需发送请求,请选择以下方式之一:

curl

注意:以下命令假定您已使用您的用户帐号通过执行 curl -X POST \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "x-goog-user-project: PROJECT_ID" \
-H "Content-Type: application/json; charset=utf-8" \
-d @request.json \
"//vision.googleapis.com/v1/images:annotate"7 或 curl -X POST \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "x-goog-user-project: PROJECT_ID" \
-H "Content-Type: application/json; charset=utf-8" \
-d @request.json \
"//vision.googleapis.com/v1/images:annotate"8 登录 curl -X POST \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "x-goog-user-project: PROJECT_ID" \
-H "Content-Type: application/json; charset=utf-8" \
-d @request.json \
"//vision.googleapis.com/v1/images:annotate"9 CLI,或者使用了 Cloud Shell,这会使您自动登录 curl -X POST \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "x-goog-user-project: PROJECT_ID" \
-H "Content-Type: application/json; charset=utf-8" \
-d @request.json \
"//vision.googleapis.com/v1/images:annotate"9 CLI。您可以执行 $cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred"; "x-goog-user-project" = "PROJECT_ID" }

Invoke-WebRequest `
-Method POST `
-Headers $headers `
-ContentType: "application/json; charset=utf-8" `
-InFile request.json `
-Uri "//vision.googleapis.com/v1/images:annotate" | Select-Object -Expand Content1 来检查当前活跃的帐号。

将请求正文保存在名为 $cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred"; "x-goog-user-project" = "PROJECT_ID" }

Invoke-WebRequest `
-Method POST `
-Headers $headers `
-ContentType: "application/json; charset=utf-8" `
-InFile request.json `
-Uri "//vision.googleapis.com/v1/images:annotate" | Select-Object -Expand Content2 的文件中,然后执行以下命令:

curl -X POST \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "x-goog-user-project: PROJECT_ID" \
-H "Content-Type: application/json; charset=utf-8" \
-d @request.json \
"//vision.googleapis.com/v1/images:annotate"

PowerShell

注意:以下命令假定您已使用您的用户帐号通过执行 curl -X POST \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "x-goog-user-project: PROJECT_ID" \
-H "Content-Type: application/json; charset=utf-8" \
-d @request.json \
"//vision.googleapis.com/v1/images:annotate"7 或 curl -X POST \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "x-goog-user-project: PROJECT_ID" \
-H "Content-Type: application/json; charset=utf-8" \
-d @request.json \
"//vision.googleapis.com/v1/images:annotate"8 登录 curl -X POST \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "x-goog-user-project: PROJECT_ID" \
-H "Content-Type: application/json; charset=utf-8" \
-d @request.json \
"//vision.googleapis.com/v1/images:annotate"9 CLI,或者使用了 Cloud Shell,这会使您自动登录 curl -X POST \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "x-goog-user-project: PROJECT_ID" \
-H "Content-Type: application/json; charset=utf-8" \
-d @request.json \
"//vision.googleapis.com/v1/images:annotate"9 CLI。您可以执行 $cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred"; "x-goog-user-project" = "PROJECT_ID" }

Invoke-WebRequest `
-Method POST `
-Headers $headers `
-ContentType: "application/json; charset=utf-8" `
-InFile request.json `
-Uri "//vision.googleapis.com/v1/images:annotate" | Select-Object -Expand Content1 来检查当前活跃的帐号。

将请求正文保存在名为 $cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred"; "x-goog-user-project" = "PROJECT_ID" }

Invoke-WebRequest `
-Method POST `
-Headers $headers `
-ContentType: "application/json; charset=utf-8" `
-InFile request.json `
-Uri "//vision.googleapis.com/v1/images:annotate" | Select-Object -Expand Content2 的文件中,然后执行以下命令:

$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred"; "x-goog-user-project" = "PROJECT_ID" }

Invoke-WebRequest `
-Method POST `
-Headers $headers `
-ContentType: "application/json; charset=utf-8" `
-InFile request.json `
-Uri "//vision.googleapis.com/v1/images:annotate" | Select-Object -Expand Content

如果请求成功,服务器将返回一个 $cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred"; "x-goog-user-project" = "PROJECT_ID" }

Invoke-WebRequest `
-Method POST `
-Headers $headers `
-ContentType: "application/json; charset=utf-8" `
-InFile request.json `
-Uri "//vision.googleapis.com/v1/images:annotate" | Select-Object -Expand Content9 HTTP 状态代码以及 JSON 格式的响应。

{ "responses": [ { "faceAnnotations": [ { "boundingPoly": { "vertices": [ { "x": 1077, "y": 157 }, { "x": 2146, "y": 157 }, { "x": 2146, "y": 1399 }, { "x": 1077, "y": 1399 } ] }, "fdBoundingPoly": { "vertices": [ { "x": 1112, "y": 407 }, { "x": 1946, "y": 407 }, { "x": 1946, "y": 1270 }, { "x": 1112, "y": 1270 } ] }, "landmarks": [ { "type": "LEFT_EYE", "position": { "x": 1368.748, "y": 739.0957, "z": 0.0024604797 } }, { "type": "RIGHT_EYE", "position": { "x": 1660.6105, "y": 751.5844, "z": -117.06496 } }, { "type": "LEFT_OF_LEFT_EYEBROW", "position": { "x": 1284.3208, "y": 666.61487, "z": 63.41506 } }, { "type": "RIGHT_OF_LEFT_EYEBROW", "position": { "x": 1418.9249, "y": 671.49414, "z": -83.82396 } }, { "type": "LEFT_OF_RIGHT_EYEBROW", "position": { "x": 1556.9579, "y": 672.2199, "z": -139.39935 } }, { "type": "RIGHT_OF_RIGHT_EYEBROW", "position": { "x": 1771.4799, "y": 682.65845, "z": -131.66716 } }, { "type": "MIDPOINT_BETWEEN_EYES", "position": { "x": 1479.6194, "y": 741.87305, "z": -114.84635 } }, { "type": "NOSE_TIP", "position": { "x": 1443.3151, "y": 917.5109, "z": -194.49301 } }, { "type": "UPPER_LIP", "position": { "x": 1466.7897, "y": 1025.3483, "z": -130.1202 } }, { "type": "LOWER_LIP", "position": { "x": 1467.2588, "y": 1147.0403, "z": -109.24505 } }, { "type": "MOUTH_LEFT", "position": { "x": 1376.8649, "y": 1066.0856, "z": -6.8136826 } }, { "type": "MOUTH_RIGHT", "position": { "x": 1652, "y": 1079.3108, "z": -106.93649 } }, { "type": "MOUTH_CENTER", "position": { "x": 1485.5554, "y": 1087.2388, "z": -110.68126 } }, { "type": "NOSE_BOTTOM_RIGHT", "position": { "x": 1571.9475, "y": 944.9213, "z": -124.11806 } }, { "type": "NOSE_BOTTOM_LEFT", "position": { "x": 1395.2339, "y": 938.12787, "z": -58.072197 } }, { "type": "NOSE_BOTTOM_CENTER", "position": { "x": 1468.4205, "y": 968.8732, "z": -132.09975 } }, { "type": "LEFT_EYE_TOP_BOUNDARY", "position": { "x": 1357.8658, "y": 711.2427, "z": -14.618992 } }, { "type": "LEFT_EYE_RIGHT_CORNER", "position": { "x": 1423.6936, "y": 750.4164, "z": -23.540215 } }, { "type": "LEFT_EYE_BOTTOM_BOUNDARY", "position": { "x": 1360.5627, "y": 762.87415, "z": -1.2607727 } }, { "type": "LEFT_EYE_LEFT_CORNER", "position": { "x": 1313.72, "y": 739.443, "z": 50.216393 } }, { "type": "RIGHT_EYE_TOP_BOUNDARY", "position": { "x": 1661.6622, "y": 718.6839, "z": -134.17404 } }, { "type": "RIGHT_EYE_RIGHT_CORNER", "position": { "x": 1730.0901, "y": 763.57104, "z": -116.365845 } }, { "type": "RIGHT_EYE_BOTTOM_BOUNDARY", "position": { "x": 1660.8823, "y": 777.3474, "z": -120.8635 } }, { "type": "RIGHT_EYE_LEFT_CORNER", "position": { "x": 1590.8903, "y": 753.5044, "z": -91.84842 } }, { "type": "LEFT_EYEBROW_UPPER_MIDPOINT", "position": { "x": 1345.7522, "y": 640.18243, "z": -27.887913 } }, { "type": "RIGHT_EYEBROW_UPPER_MIDPOINT", "position": { "x": 1660.5848, "y": 648.36145, "z": -153.73691 } }, { "type": "LEFT_EAR_TRAGION", "position": { "x": 1274.1006, "y": 826.2645, "z": 422.6642 } }, { "type": "RIGHT_EAR_TRAGION", "position": { "x": 2014.8041, "y": 908.56537, "z": 149.61232 } }, { "type": "FOREHEAD_GLABELLA", "position": { "x": 1476.2395, "y": 669.9625, "z": -120.59111 } }, { "type": "CHIN_GNATHION", "position": { "x": 1477.3256, "y": 1269.3269, "z": -67.748795 } }, { "type": "CHIN_LEFT_GONION", "position": { "x": 1336.8848, "y": 1096.2242, "z": 286.73004 } }, { "type": "CHIN_RIGHT_GONION", "position": { "x": 1863.2197, "y": 1128.6213, "z": 68.90431 } }, { "type": "LEFT_CHEEK_CENTER", "position": { "x": 1317.8549, "y": 940.8025, "z": 50.863163 } }, { "type": "RIGHT_CHEEK_CENTER", "position": { "x": 1733.4912, "y": 964.073, "z": -112.43947 } } ], "rollAngle": 1.5912293, "panAngle": -22.01964, "tiltAngle": -1.4997566, "detectionConfidence": 0.9310801, "landmarkingConfidence": 0.5775582, "joyLikelihood": "VERY_LIKELY", "sorrowLikelihood": "VERY_UNLIKELY", "angerLikelihood": "VERY_UNLIKELY", "surpriseLikelihood": "VERY_UNLIKELY", "underExposedLikelihood": "VERY_UNLIKELY", "blurredLikelihood": "VERY_UNLIKELY", "headwearLikelihood": "POSSIBLE" }, { "boundingPoly": { "vertices": [ { "x": 144, "y": 1273 }, { "x": 793, "y": 1273 }, { "x": 793, "y": 1844 }, { "x": 144, "y": 1844 } ] }, "fdBoundingPoly": { "vertices": [ { "x": 181, "y": 1373 }, { "x": 742, "y": 1373 }, { "x": 742, "y": 1844 }, { "x": 181, "y": 1844 } ] }, "landmarks": [ { "type": "LEFT_EYE", "position": { "x": 356.13745, "y": 1635.7034, "z": 0.0045757294 } }, { "type": "RIGHT_EYE", "position": { "x": 557.07324, "y": 1601.1769, "z": -10.258446 } }, { "type": "LEFT_OF_LEFT_EYEBROW", "position": { "x": 284.70563, "y": 1599.5238, "z": 28.755493 } }, { "type": "RIGHT_OF_LEFT_EYEBROW", "position": { "x": 397.47183, "y": 1574.1455, "z": -28.716581 } }, { "type": "LEFT_OF_RIGHT_EYEBROW", "position": { "x": 484.00983, "y": 1559.5669, "z": -33.509003 } }, { "type": "RIGHT_OF_RIGHT_EYEBROW", "position": { "x": 607.31726, "y": 1551.2396, "z": 11.0225525 } }, { "type": "MIDPOINT_BETWEEN_EYES", "position": { "x": 447.86597, "y": 1603.2458, "z": -40.69277 } }, { "type": "NOSE_TIP", "position": { "x": 463.15356, "y": 1705.7849, "z": -114.36831 } }, { "type": "UPPER_LIP", "position": { "x": 475.02646, "y": 1779.54, "z": -85.219086 } }, { "type": "LOWER_LIP", "position": { "x": 483.2983, "y": 1844.4594, "z": -83.812 } }, { "type": "MOUTH_LEFT", "position": { "x": 391.11206, "y": 1824.9432, "z": -34.578503 } }, { "type": "MOUTH_RIGHT", "position": { "x": 559.85266, "y": 1797.929, "z": -44.700863 } }, { "type": "MOUTH_CENTER", "position": { "x": 478.21106, "y": 1807.5089, "z": -76.46759 } }, { "type": "NOSE_BOTTOM_RIGHT", "position": { "x": 522.9539, "y": 1717.8636, "z": -51.489075 } }, { "type": "NOSE_BOTTOM_LEFT", "position": { "x": 414.95767, "y": 1739.2955, "z": -46.75015 } }, { "type": "NOSE_BOTTOM_CENTER", "position": { "x": 468.7361, "y": 1739.5958, "z": -78.64168 } }, { "type": "LEFT_EYE_TOP_BOUNDARY", "position": { "x": 352.39365, "y": 1618.0576, "z": -7.2005444 } }, { "type": "LEFT_EYE_RIGHT_CORNER", "position": { "x": 395.81454, "y": 1629.9379, "z": -2.4021797 } }, { "type": "LEFT_EYE_BOTTOM_BOUNDARY", "position": { "x": 357.511, "y": 1649.6553, "z": -4.4735374 } }, { "type": "LEFT_EYE_LEFT_CORNER", "position": { "x": 316.1426, "y": 1645.2771, "z": 18.701395 } }, { "type": "RIGHT_EYE_TOP_BOUNDARY", "position": { "x": 553.78973, "y": 1582.3448, "z": -17.07942 } }, { "type": "RIGHT_EYE_RIGHT_CORNER", "position": { "x": 596.6489, "y": 1599.1897, "z": 4.014868 } }, { "type": "RIGHT_EYE_BOTTOM_BOUNDARY", "position": { "x": 558.60706, "y": 1615.964, "z": -15.077105 } }, { "type": "RIGHT_EYE_LEFT_CORNER", "position": { "x": 514.8054, "y": 1605.6407, "z": -7.929638 } }, { "type": "LEFT_EYEBROW_UPPER_MIDPOINT", "position": { "x": 336.4973, "y": 1567.6466, "z": -7.853897 } }, { "type": "RIGHT_EYEBROW_UPPER_MIDPOINT", "position": { "x": 542.3708, "y": 1536.191, "z": -19.405855 } }, { "type": "LEFT_EAR_TRAGION", "position": { "x": 231.38948, "y": 1749.3823, "z": 221.4534 } }, { "type": "RIGHT_EAR_TRAGION", "position": { "x": 712.5644, "y": 1670.4897, "z": 199.4929 } }, { "type": "FOREHEAD_GLABELLA", "position": { "x": 439.35938, "y": 1561.1454, "z": -36.451645 } }, { "type": "CHIN_GNATHION", "position": { "x": 501.61096, "y": 1942.0133, "z": -75.04764 } }, { "type": "CHIN_LEFT_GONION", "position": { "x": 304.9834, "y": 1892.5361, "z": 114.12407 } }, { "type": "CHIN_RIGHT_GONION", "position": { "x": 684.92535, "y": 1824.337, "z": 96.13425 } }, { "type": "LEFT_CHEEK_CENTER", "position": { "x": 334.5645, "y": 1764.659, "z": -2.0755844 } }, { "type": "RIGHT_CHEEK_CENTER", "position": { "x": 609.5919, "y": 1719.6847, "z": -16.861538 } } ], "rollAngle": -8.514851, "panAngle": -3.096844, "tiltAngle": 9.26052, "detectionConfidence": 0.5463216, "landmarkingConfidence": 0.55711126, "joyLikelihood": "VERY_UNLIKELY", "sorrowLikelihood": "VERY_UNLIKELY", "angerLikelihood": "VERY_UNLIKELY", "surpriseLikelihood": "VERY_UNLIKELY", "underExposedLikelihood": "VERY_UNLIKELY", "blurredLikelihood": "UNLIKELY", "headwearLikelihood": "VERY_UNLIKELY" }, { "boundingPoly": { "vertices": [ { "x": 785, "y": 167 }, { "x": 1100, "y": 167 }, { "x": 1100, "y": 534 }, { "x": 785, "y": 534 } ] }, "fdBoundingPoly": { "vertices": [ { "x": 834, "y": 220 }, { "x": 1101, "y": 220 }, { "x": 1101, "y": 506 }, { "x": 834, "y": 506 } ] }, "landmarks": [ { "type": "LEFT_EYE", "position": { "x": 933.74615, "y": 351.82394, "z": -0.00068986416 } }, { "type": "RIGHT_EYE", "position": { "x": 1005.8836, "y": 329.02396, "z": 43.38338 } }, { "type": "LEFT_OF_LEFT_EYEBROW", "position": { "x": 901.93494, "y": 333.3503, "z": -9.714935 } }, { "type": "RIGHT_OF_LEFT_EYEBROW", "position": { "x": 957.4015, "y": 319.9436, "z": -6.8983736 } }, { "type": "LEFT_OF_RIGHT_EYEBROW", "position": { "x": 987.50134, "y": 308.46817, "z": 13.108145 } }, { "type": "RIGHT_OF_RIGHT_EYEBROW", "position": { "x": 1031.5519, "y": 298.8843, "z": 65.60683 } }, { "type": "MIDPOINT_BETWEEN_EYES", "position": { "x": 979.4568, "y": 336.0551, "z": 3.8077774 } }, { "type": "NOSE_TIP", "position": { "x": 1003.45795, "y": 398.80377, "z": -17.351936 } }, { "type": "UPPER_LIP", "position": { "x": 1000.16614, "y": 432.11664, "z": 5.2740355 } }, { "type": "LOWER_LIP", "position": { "x": 1004.0378, "y": 456.92422, "z": 13.545323 } }, { "type": "MOUTH_LEFT", "position": { "x": 961.922, "y": 448.64325, "z": 11.117096 } }, { "type": "MOUTH_RIGHT", "position": { "x": 1025.2979, "y": 432.70157, "z": 47.89795 } }, { "type": "MOUTH_CENTER", "position": { "x": 1002.51434, "y": 443.3482, "z": 13.021965 } }, { "type": "NOSE_BOTTOM_RIGHT", "position": { "x": 1015.5027, "y": 402.8421, "z": 28.03568 } }, { "type": "NOSE_BOTTOM_LEFT", "position": { "x": 969.764, "y": 413.05563, "z": 3.1156778 } }, { "type": "NOSE_BOTTOM_CENTER", "position": { "x": 997.8564, "y": 416.98083, "z": 3.3404813 } }, { "type": "LEFT_EYE_TOP_BOUNDARY", "position": { "x": 930.542, "y": 343.17078, "z": -6.9020395 } }, { "type": "LEFT_EYE_RIGHT_CORNER", "position": { "x": 950.7726, "y": 348.11346, "z": 9.216144 } }, { "type": "LEFT_EYE_BOTTOM_BOUNDARY", "position": { "x": 933.6862, "y": 359.50848, "z": -1.3347243 } }, { "type": "LEFT_EYE_LEFT_CORNER", "position": { "x": 914.83966, "y": 356.1447, "z": -1.4299142 } }, { "type": "RIGHT_EYE_TOP_BOUNDARY", "position": { "x": 1006.59766, "y": 319.50406, "z": 38.31219 } }, { "type": "RIGHT_EYE_RIGHT_CORNER", "position": { "x": 1021.45886, "y": 327.68784, "z": 61.100002 } }, { "type": "RIGHT_EYE_BOTTOM_BOUNDARY", "position": { "x": 1009.46686, "y": 336.0832, "z": 43.87975 } }, { "type": "RIGHT_EYE_LEFT_CORNER", "position": { "x": 991.17535, "y": 331.97632, "z": 34.4881 } }, { "type": "LEFT_EYEBROW_UPPER_MIDPOINT", "position": { "x": 928.40436, "y": 317.13898, "z": -14.411907 } }, { "type": "RIGHT_EYEBROW_UPPER_MIDPOINT", "position": { "x": 1008.5887, "y": 294.364, "z": 32.917953 } }, { "type": "LEFT_EAR_TRAGION", "position": { "x": 835.18915, "y": 395.7093, "z": 81.31065 } }, { "type": "RIGHT_EAR_TRAGION", "position": { "x": 1024.4136, "y": 360.64178, "z": 182.02446 } }, { "type": "FOREHEAD_GLABELLA", "position": { "x": 975.5221, "y": 315.06647, "z": 0.31154716 } }, { "type": "CHIN_GNATHION", "position": { "x": 1010.74097, "y": 503.23572, "z": 29.966637 } }, { "type": "CHIN_LEFT_GONION", "position": { "x": 891.86237, "y": 466.7829, "z": 58.84553 } }, { "type": "CHIN_RIGHT_GONION", "position": { "x": 1031.9008, "y": 428.13455, "z": 145.42484 } }, { "type": "LEFT_CHEEK_CENTER", "position": { "x": 929.4197, "y": 418.09122, "z": 4.574672 } }, { "type": "RIGHT_CHEEK_CENTER", "position": { "x": 1033.7278, "y": 390.5432, "z": 65.6329 } } ], "rollAngle": -12.077273, "panAngle": 27.194477, "tiltAngle": -5.252778, "detectionConfidence": 0.38126788, "landmarkingConfidence": 0.040030442, "joyLikelihood": "VERY_UNLIKELY", "sorrowLikelihood": "VERY_UNLIKELY", "angerLikelihood": "VERY_UNLIKELY", "surpriseLikelihood": "VERY_UNLIKELY", "underExposedLikelihood": "LIKELY", "blurredLikelihood": "VERY_LIKELY", "headwearLikelihood": "VERY_UNLIKELY" } ] } ] } 0 响应包括检测到的所有人脸的边界框、在人脸上检测到的重要部位(眼睛、鼻子、嘴巴等)及人脸和图片属性(喜悦、悲伤、愤怒、惊奇等)的置信度评分。

响应

{ "responses": [ { "faceAnnotations": [ { "boundingPoly": { "vertices": [ { "x": 1077, "y": 157 }, { "x": 2146, "y": 157 }, { "x": 2146, "y": 1399 }, { "x": 1077, "y": 1399 } ] }, "fdBoundingPoly": { "vertices": [ { "x": 1112, "y": 407 }, { "x": 1946, "y": 407 }, { "x": 1946, "y": 1270 }, { "x": 1112, "y": 1270 } ] }, "landmarks": [ { "type": "LEFT_EYE", "position": { "x": 1368.748, "y": 739.0957, "z": 0.0024604797 } }, { "type": "RIGHT_EYE", "position": { "x": 1660.6105, "y": 751.5844, "z": -117.06496 } }, { "type": "LEFT_OF_LEFT_EYEBROW", "position": { "x": 1284.3208, "y": 666.61487, "z": 63.41506 } }, { "type": "RIGHT_OF_LEFT_EYEBROW", "position": { "x": 1418.9249, "y": 671.49414, "z": -83.82396 } }, { "type": "LEFT_OF_RIGHT_EYEBROW", "position": { "x": 1556.9579, "y": 672.2199, "z": -139.39935 } }, { "type": "RIGHT_OF_RIGHT_EYEBROW", "position": { "x": 1771.4799, "y": 682.65845, "z": -131.66716 } }, { "type": "MIDPOINT_BETWEEN_EYES", "position": { "x": 1479.6194, "y": 741.87305, "z": -114.84635 } }, { "type": "NOSE_TIP", "position": { "x": 1443.3151, "y": 917.5109, "z": -194.49301 } }, { "type": "UPPER_LIP", "position": { "x": 1466.7897, "y": 1025.3483, "z": -130.1202 } }, { "type": "LOWER_LIP", "position": { "x": 1467.2588, "y": 1147.0403, "z": -109.24505 } }, { "type": "MOUTH_LEFT", "position": { "x": 1376.8649, "y": 1066.0856, "z": -6.8136826 } }, { "type": "MOUTH_RIGHT", "position": { "x": 1652, "y": 1079.3108, "z": -106.93649 } }, { "type": "MOUTH_CENTER", "position": { "x": 1485.5554, "y": 1087.2388, "z": -110.68126 } }, { "type": "NOSE_BOTTOM_RIGHT", "position": { "x": 1571.9475, "y": 944.9213, "z": -124.11806 } }, { "type": "NOSE_BOTTOM_LEFT", "position": { "x": 1395.2339, "y": 938.12787, "z": -58.072197 } }, { "type": "NOSE_BOTTOM_CENTER", "position": { "x": 1468.4205, "y": 968.8732, "z": -132.09975 } }, { "type": "LEFT_EYE_TOP_BOUNDARY", "position": { "x": 1357.8658, "y": 711.2427, "z": -14.618992 } }, { "type": "LEFT_EYE_RIGHT_CORNER", "position": { "x": 1423.6936, "y": 750.4164, "z": -23.540215 } }, { "type": "LEFT_EYE_BOTTOM_BOUNDARY", "position": { "x": 1360.5627, "y": 762.87415, "z": -1.2607727 } }, { "type": "LEFT_EYE_LEFT_CORNER", "position": { "x": 1313.72, "y": 739.443, "z": 50.216393 } }, { "type": "RIGHT_EYE_TOP_BOUNDARY", "position": { "x": 1661.6622, "y": 718.6839, "z": -134.17404 } }, { "type": "RIGHT_EYE_RIGHT_CORNER", "position": { "x": 1730.0901, "y": 763.57104, "z": -116.365845 } }, { "type": "RIGHT_EYE_BOTTOM_BOUNDARY", "position": { "x": 1660.8823, "y": 777.3474, "z": -120.8635 } }, { "type": "RIGHT_EYE_LEFT_CORNER", "position": { "x": 1590.8903, "y": 753.5044, "z": -91.84842 } }, { "type": "LEFT_EYEBROW_UPPER_MIDPOINT", "position": { "x": 1345.7522, "y": 640.18243, "z": -27.887913 } }, { "type": "RIGHT_EYEBROW_UPPER_MIDPOINT", "position": { "x": 1660.5848, "y": 648.36145, "z": -153.73691 } }, { "type": "LEFT_EAR_TRAGION", "position": { "x": 1274.1006, "y": 826.2645, "z": 422.6642 } }, { "type": "RIGHT_EAR_TRAGION", "position": { "x": 2014.8041, "y": 908.56537, "z": 149.61232 } }, { "type": "FOREHEAD_GLABELLA", "position": { "x": 1476.2395, "y": 669.9625, "z": -120.59111 } }, { "type": "CHIN_GNATHION", "position": { "x": 1477.3256, "y": 1269.3269, "z": -67.748795 } }, { "type": "CHIN_LEFT_GONION", "position": { "x": 1336.8848, "y": 1096.2242, "z": 286.73004 } }, { "type": "CHIN_RIGHT_GONION", "position": { "x": 1863.2197, "y": 1128.6213, "z": 68.90431 } }, { "type": "LEFT_CHEEK_CENTER", "position": { "x": 1317.8549, "y": 940.8025, "z": 50.863163 } }, { "type": "RIGHT_CHEEK_CENTER", "position": { "x": 1733.4912, "y": 964.073, "z": -112.43947 } } ], "rollAngle": 1.5912293, "panAngle": -22.01964, "tiltAngle": -1.4997566, "detectionConfidence": 0.9310801, "landmarkingConfidence": 0.5775582, "joyLikelihood": "VERY_LIKELY", "sorrowLikelihood": "VERY_UNLIKELY", "angerLikelihood": "VERY_UNLIKELY", "surpriseLikelihood": "VERY_UNLIKELY", "underExposedLikelihood": "VERY_UNLIKELY", "blurredLikelihood": "VERY_UNLIKELY", "headwearLikelihood": "POSSIBLE" }, { "boundingPoly": { "vertices": [ { "x": 144, "y": 1273 }, { "x": 793, "y": 1273 }, { "x": 793, "y": 1844 }, { "x": 144, "y": 1844 } ] }, "fdBoundingPoly": { "vertices": [ { "x": 181, "y": 1373 }, { "x": 742, "y": 1373 }, { "x": 742, "y": 1844 }, { "x": 181, "y": 1844 } ] }, "landmarks": [ { "type": "LEFT_EYE", "position": { "x": 356.13745, "y": 1635.7034, "z": 0.0045757294 } }, { "type": "RIGHT_EYE", "position": { "x": 557.07324, "y": 1601.1769, "z": -10.258446 } }, { "type": "LEFT_OF_LEFT_EYEBROW", "position": { "x": 284.70563, "y": 1599.5238, "z": 28.755493 } }, { "type": "RIGHT_OF_LEFT_EYEBROW", "position": { "x": 397.47183, "y": 1574.1455, "z": -28.716581 } }, { "type": "LEFT_OF_RIGHT_EYEBROW", "position": { "x": 484.00983, "y": 1559.5669, "z": -33.509003 } }, { "type": "RIGHT_OF_RIGHT_EYEBROW", "position": { "x": 607.31726, "y": 1551.2396, "z": 11.0225525 } }, { "type": "MIDPOINT_BETWEEN_EYES", "position": { "x": 447.86597, "y": 1603.2458, "z": -40.69277 } }, { "type": "NOSE_TIP", "position": { "x": 463.15356, "y": 1705.7849, "z": -114.36831 } }, { "type": "UPPER_LIP", "position": { "x": 475.02646, "y": 1779.54, "z": -85.219086 } }, { "type": "LOWER_LIP", "position": { "x": 483.2983, "y": 1844.4594, "z": -83.812 } }, { "type": "MOUTH_LEFT", "position": { "x": 391.11206, "y": 1824.9432, "z": -34.578503 } }, { "type": "MOUTH_RIGHT", "position": { "x": 559.85266, "y": 1797.929, "z": -44.700863 } }, { "type": "MOUTH_CENTER", "position": { "x": 478.21106, "y": 1807.5089, "z": -76.46759 } }, { "type": "NOSE_BOTTOM_RIGHT", "position": { "x": 522.9539, "y": 1717.8636, "z": -51.489075 } }, { "type": "NOSE_BOTTOM_LEFT", "position": { "x": 414.95767, "y": 1739.2955, "z": -46.75015 } }, { "type": "NOSE_BOTTOM_CENTER", "position": { "x": 468.7361, "y": 1739.5958, "z": -78.64168 } }, { "type": "LEFT_EYE_TOP_BOUNDARY", "position": { "x": 352.39365, "y": 1618.0576, "z": -7.2005444 } }, { "type": "LEFT_EYE_RIGHT_CORNER", "position": { "x": 395.81454, "y": 1629.9379, "z": -2.4021797 } }, { "type": "LEFT_EYE_BOTTOM_BOUNDARY", "position": { "x": 357.511, "y": 1649.6553, "z": -4.4735374 } }, { "type": "LEFT_EYE_LEFT_CORNER", "position": { "x": 316.1426, "y": 1645.2771, "z": 18.701395 } }, { "type": "RIGHT_EYE_TOP_BOUNDARY", "position": { "x": 553.78973, "y": 1582.3448, "z": -17.07942 } }, { "type": "RIGHT_EYE_RIGHT_CORNER", "position": { "x": 596.6489, "y": 1599.1897, "z": 4.014868 } }, { "type": "RIGHT_EYE_BOTTOM_BOUNDARY", "position": { "x": 558.60706, "y": 1615.964, "z": -15.077105 } }, { "type": "RIGHT_EYE_LEFT_CORNER", "position": { "x": 514.8054, "y": 1605.6407, "z": -7.929638 } }, { "type": "LEFT_EYEBROW_UPPER_MIDPOINT", "position": { "x": 336.4973, "y": 1567.6466, "z": -7.853897 } }, { "type": "RIGHT_EYEBROW_UPPER_MIDPOINT", "position": { "x": 542.3708, "y": 1536.191, "z": -19.405855 } }, { "type": "LEFT_EAR_TRAGION", "position": { "x": 231.38948, "y": 1749.3823, "z": 221.4534 } }, { "type": "RIGHT_EAR_TRAGION", "position": { "x": 712.5644, "y": 1670.4897, "z": 199.4929 } }, { "type": "FOREHEAD_GLABELLA", "position": { "x": 439.35938, "y": 1561.1454, "z": -36.451645 } }, { "type": "CHIN_GNATHION", "position": { "x": 501.61096, "y": 1942.0133, "z": -75.04764 } }, { "type": "CHIN_LEFT_GONION", "position": { "x": 304.9834, "y": 1892.5361, "z": 114.12407 } }, { "type": "CHIN_RIGHT_GONION", "position": { "x": 684.92535, "y": 1824.337, "z": 96.13425 } }, { "type": "LEFT_CHEEK_CENTER", "position": { "x": 334.5645, "y": 1764.659, "z": -2.0755844 } }, { "type": "RIGHT_CHEEK_CENTER", "position": { "x": 609.5919, "y": 1719.6847, "z": -16.861538 } } ], "rollAngle": -8.514851, "panAngle": -3.096844, "tiltAngle": 9.26052, "detectionConfidence": 0.5463216, "landmarkingConfidence": 0.55711126, "joyLikelihood": "VERY_UNLIKELY", "sorrowLikelihood": "VERY_UNLIKELY", "angerLikelihood": "VERY_UNLIKELY", "surpriseLikelihood": "VERY_UNLIKELY", "underExposedLikelihood": "VERY_UNLIKELY", "blurredLikelihood": "UNLIKELY", "headwearLikelihood": "VERY_UNLIKELY" }, { "boundingPoly": { "vertices": [ { "x": 785, "y": 167 }, { "x": 1100, "y": 167 }, { "x": 1100, "y": 534 }, { "x": 785, "y": 534 } ] }, "fdBoundingPoly": { "vertices": [ { "x": 834, "y": 220 }, { "x": 1101, "y": 220 }, { "x": 1101, "y": 506 }, { "x": 834, "y": 506 } ] }, "landmarks": [ { "type": "LEFT_EYE", "position": { "x": 933.74615, "y": 351.82394, "z": -0.00068986416 } }, { "type": "RIGHT_EYE", "position": { "x": 1005.8836, "y": 329.02396, "z": 43.38338 } }, { "type": "LEFT_OF_LEFT_EYEBROW", "position": { "x": 901.93494, "y": 333.3503, "z": -9.714935 } }, { "type": "RIGHT_OF_LEFT_EYEBROW", "position": { "x": 957.4015, "y": 319.9436, "z": -6.8983736 } }, { "type": "LEFT_OF_RIGHT_EYEBROW", "position": { "x": 987.50134, "y": 308.46817, "z": 13.108145 } }, { "type": "RIGHT_OF_RIGHT_EYEBROW", "position": { "x": 1031.5519, "y": 298.8843, "z": 65.60683 } }, { "type": "MIDPOINT_BETWEEN_EYES", "position": { "x": 979.4568, "y": 336.0551, "z": 3.8077774 } }, { "type": "NOSE_TIP", "position": { "x": 1003.45795, "y": 398.80377, "z": -17.351936 } }, { "type": "UPPER_LIP", "position": { "x": 1000.16614, "y": 432.11664, "z": 5.2740355 } }, { "type": "LOWER_LIP", "position": { "x": 1004.0378, "y": 456.92422, "z": 13.545323 } }, { "type": "MOUTH_LEFT", "position": { "x": 961.922, "y": 448.64325, "z": 11.117096 } }, { "type": "MOUTH_RIGHT", "position": { "x": 1025.2979, "y": 432.70157, "z": 47.89795 } }, { "type": "MOUTH_CENTER", "position": { "x": 1002.51434, "y": 443.3482, "z": 13.021965 } }, { "type": "NOSE_BOTTOM_RIGHT", "position": { "x": 1015.5027, "y": 402.8421, "z": 28.03568 } }, { "type": "NOSE_BOTTOM_LEFT", "position": { "x": 969.764, "y": 413.05563, "z": 3.1156778 } }, { "type": "NOSE_BOTTOM_CENTER", "position": { "x": 997.8564, "y": 416.98083, "z": 3.3404813 } }, { "type": "LEFT_EYE_TOP_BOUNDARY", "position": { "x": 930.542, "y": 343.17078, "z": -6.9020395 } }, { "type": "LEFT_EYE_RIGHT_CORNER", "position": { "x": 950.7726, "y": 348.11346, "z": 9.216144 } }, { "type": "LEFT_EYE_BOTTOM_BOUNDARY", "position": { "x": 933.6862, "y": 359.50848, "z": -1.3347243 } }, { "type": "LEFT_EYE_LEFT_CORNER", "position": { "x": 914.83966, "y": 356.1447, "z": -1.4299142 } }, { "type": "RIGHT_EYE_TOP_BOUNDARY", "position": { "x": 1006.59766, "y": 319.50406, "z": 38.31219 } }, { "type": "RIGHT_EYE_RIGHT_CORNER", "position": { "x": 1021.45886, "y": 327.68784, "z": 61.100002 } }, { "type": "RIGHT_EYE_BOTTOM_BOUNDARY", "position": { "x": 1009.46686, "y": 336.0832, "z": 43.87975 } }, { "type": "RIGHT_EYE_LEFT_CORNER", "position": { "x": 991.17535, "y": 331.97632, "z": 34.4881 } }, { "type": "LEFT_EYEBROW_UPPER_MIDPOINT", "position": { "x": 928.40436, "y": 317.13898, "z": -14.411907 } }, { "type": "RIGHT_EYEBROW_UPPER_MIDPOINT", "position": { "x": 1008.5887, "y": 294.364, "z": 32.917953 } }, { "type": "LEFT_EAR_TRAGION", "position": { "x": 835.18915, "y": 395.7093, "z": 81.31065 } }, { "type": "RIGHT_EAR_TRAGION", "position": { "x": 1024.4136, "y": 360.64178, "z": 182.02446 } }, { "type": "FOREHEAD_GLABELLA", "position": { "x": 975.5221, "y": 315.06647, "z": 0.31154716 } }, { "type": "CHIN_GNATHION", "position": { "x": 1010.74097, "y": 503.23572, "z": 29.966637 } }, { "type": "CHIN_LEFT_GONION", "position": { "x": 891.86237, "y": 466.7829, "z": 58.84553 } }, { "type": "CHIN_RIGHT_GONION", "position": { "x": 1031.9008, "y": 428.13455, "z": 145.42484 } }, { "type": "LEFT_CHEEK_CENTER", "position": { "x": 929.4197, "y": 418.09122, "z": 4.574672 } }, { "type": "RIGHT_CHEEK_CENTER", "position": { "x": 1033.7278, "y": 390.5432, "z": 65.6329 } } ], "rollAngle": -12.077273, "panAngle": 27.194477, "tiltAngle": -5.252778, "detectionConfidence": 0.38126788, "landmarkingConfidence": 0.040030442, "joyLikelihood": "VERY_UNLIKELY", "sorrowLikelihood": "VERY_UNLIKELY", "angerLikelihood": "VERY_UNLIKELY", "surpriseLikelihood": "VERY_UNLIKELY", "underExposedLikelihood": "LIKELY", "blurredLikelihood": "VERY_LIKELY", "headwearLikelihood": "VERY_UNLIKELY" } ] } ] }

Go

试用此示例之前,请按照《Vision 快速入门:使用客户端库》中的 Go 设置说明进行操作。如需了解详情,请参阅 Vision Go API 参考文档。

在 GitHub 上查看 反馈

// detectFaces gets faces from the Vision API for an image at the given file path. func detectFaces(w io.Writer, file string) error { ctx := context.Background() client, err := vision.NewImageAnnotatorClient(ctx) if err != nil { return err } defer client.Close() f, err := os.Open(file) if err != nil { return err } defer f.Close() image, err := vision.NewImageFromReader(f) if err != nil { return err } annotations, err := client.DetectFaces(ctx, image, nil, 10) if err != nil { return err } if len(annotations) == 0 { fmt.Fprintln(w, "No faces found.") } else { fmt.Fprintln(w, "Faces:") for i, annotation := range annotations { fmt.Fprintln(w, " Face", i) fmt.Fprintln(w, " Anger:", annotation.AngerLikelihood) fmt.Fprintln(w, " Joy:", annotation.JoyLikelihood) fmt.Fprintln(w, " Surprise:", annotation.SurpriseLikelihood) } } return nil }

Java

在试用此示例之前,请按照Vision API 快速入门:使用客户端库中的 Java 设置说明进行操作。如需了解详情,请参阅 Vision API Java 参考文档。

注意:对于 Java Spring 框架用户,Spring Cloud Google Cloud 提供了一种身份验证设置和客户端对象的自动配置方法来使用 Vision API。

在 GitHub 上查看 反馈

import com.google.cloud.vision.v1.AnnotateImageRequest; import com.google.cloud.vision.v1.AnnotateImageResponse; import com.google.cloud.vision.v1.BatchAnnotateImagesResponse; import com.google.cloud.vision.v1.FaceAnnotation; import com.google.cloud.vision.v1.Feature; import com.google.cloud.vision.v1.Image; import com.google.cloud.vision.v1.ImageAnnotatorClient; import com.google.protobuf.ByteString; import java.io.FileInputStream; import java.io.IOException; import java.util.ArrayList; import java.util.List; public class DetectFaces { public static void detectFaces() throws IOException { // TODO(developer): Replace these variables before running the sample. String filePath = "path/to/your/image/file.jpg"; detectFaces(filePath); } // Detects faces in the specified local image. public static void detectFaces(String filePath) throws IOException { List<AnnotateImageRequest> requests = new ArrayList<>(); ByteString imgBytes = ByteString.readFrom(new FileInputStream(filePath)); Image img = Image.newBuilder().setContent(imgBytes).build(); Feature feat = Feature.newBuilder().setType(Feature.Type.FACE_DETECTION).build(); AnnotateImageRequest request = AnnotateImageRequest.newBuilder().addFeatures(feat).setImage(img).build(); requests.add(request); // Initialize client that will be used to send requests. This client only needs to be created // once, and can be reused for multiple requests. After completing all of your requests, call // the "close" method on the client to safely clean up any remaining background resources. try (ImageAnnotatorClient client = ImageAnnotatorClient.create()) { BatchAnnotateImagesResponse response = client.batchAnnotateImages(requests); List<AnnotateImageResponse> responses = response.getResponsesList(); for (AnnotateImageResponse res : responses) { if (res.hasError()) { System.out.format("Error: %s%n", res.getError().getMessage()); return; } // For full list of available annotations, see //g.co/cloud/vision/docs for (FaceAnnotation annotation : res.getFaceAnnotationsList()) { System.out.format( "anger: %s%njoy: %s%nsurprise: %s%nposition: %s", annotation.getAngerLikelihood(), annotation.getJoyLikelihood(), annotation.getSurpriseLikelihood(), annotation.getBoundingPoly()); } } } } }

Node.js

试用此示例之前,请按照《Vision 快速入门:使用客户端库》中的 Node.js 设置说明进行操作。如需了解详情,请参阅 Vision Node.js API 参考文档。

在 GitHub 上查看 反馈

// Imports the Google Cloud client library const vision = require('@google-cloud/vision'); // Creates a client const client = new vision.ImageAnnotatorClient(); async function detectFaces() { /** * TODO(developer): Uncomment the following line before running the sample. */ // const fileName = 'Local image file, e.g. /path/to/image.png'; const [result] = await client.faceDetection(fileName); const faces = result.faceAnnotations; console.log('Faces:'); faces.forEach((face, i) => { console.log(` Face #${i + 1}:`); console.log(` Joy: ${face.joyLikelihood}`); console.log(` Anger: ${face.angerLikelihood}`); console.log(` Sorrow: ${face.sorrowLikelihood}`); console.log(` Surprise: ${face.surpriseLikelihood}`); }); } detectFaces();

Python

试用此示例之前,请按照《Vision 快速入门:使用客户端库》中的 Python 设置说明进行操作。如需了解详情,请参阅 Vision Python API 参考文档。

在 GitHub 上查看 反馈

def detect_faces(path): """Detects faces in an image.""" from google.cloud import vision import io client = vision.ImageAnnotatorClient() with io.open(path, 'rb') as image_file: content = image_file.read() image = vision.Image(content=content) response = client.face_detection(image=image) faces = response.face_annotations # Names of likelihood from google.cloud.vision.enums likelihood_name = ('UNKNOWN', 'VERY_UNLIKELY', 'UNLIKELY', 'POSSIBLE', 'LIKELY', 'VERY_LIKELY') print('Faces:') for face in faces: print('anger: {}'.format(likelihood_name[face.anger_likelihood])) print('joy: {}'.format(likelihood_name[face.joy_likelihood])) print('surprise: {}'.format(likelihood_name[face.surprise_likelihood])) vertices = (['({},{})'.format(vertex.x, vertex.y) for vertex in face.bounding_poly.vertices]) print('face bounds: {}'.format(','.join(vertices))) if response.error.message: raise Exception( '{}\nFor more info on error messages, check: ' '//cloud.google.com/apis/design/errors'.format( response.error.message))

其他语言

C#: 请按照客户端库页面上的 C# 设置说明操作,然后访问 .NET 版 Vision 参考文档。

PHP: 请按照客户端库页面上的 PHP 设置说明操作,然后访问 PHP 版 Vision 参考文档。

Ruby 版: 请按照客户端库页面上的 Ruby 设置说明操作,然后访问 Ruby 版 Vision 参考文档。

检测远程图片中的人脸

Vision API 可对 Cloud Storage 或网络中的远程图片文件执行特征检测。发送远程文件请求时,您需要指定文件网址,而无需在请求正文中发送图片文件的内容。

警告:从 HTTP/HTTPS 网址提取图片时,Google 无法保证请求会完成。如果指定的主机拒绝请求(例如,由于请求限制或 DoS 攻击防范),或者如果 Google 为了防止滥用而限制对网站的请求,则您的请求可能会失败。最佳实践是,对于生产应用不要依赖外部托管的图片。

REST

在使用任何请求数据之前,请先进行以下替换:

  • CLOUD_STORAGE_IMAGE_URI:Cloud Storage 存储分区中有效图片文件的路径。您必须至少拥有该文件的读取权限。 示例:
    • gs://cloud-samples-data/vision/face/faces.jpeg
  • RESULTS_INT:(可选)要返回的结果的整数值。如果您省略 curl -X POST \
    -H "Authorization: Bearer $(gcloud auth print-access-token)" \
    -H "x-goog-user-project: PROJECT_ID" \
    -H "Content-Type: application/json; charset=utf-8" \
    -d @request.json \
    "//vision.googleapis.com/v1/images:annotate"3 字段及其值,则 API 会默认返回 10 个结果。此字段不适用于以下功能类型:curl -X POST \
    -H "Authorization: Bearer $(gcloud auth print-access-token)" \
    -H "x-goog-user-project: PROJECT_ID" \
    -H "Content-Type: application/json; charset=utf-8" \
    -d @request.json \
    "//vision.googleapis.com/v1/images:annotate"4、curl -X POST \
    -H "Authorization: Bearer $(gcloud auth print-access-token)" \
    -H "x-goog-user-project: PROJECT_ID" \
    -H "Content-Type: application/json; charset=utf-8" \
    -d @request.json \
    "//vision.googleapis.com/v1/images:annotate"5 或 curl -X POST \
    -H "Authorization: Bearer $(gcloud auth print-access-token)" \
    -H "x-goog-user-project: PROJECT_ID" \
    -H "Content-Type: application/json; charset=utf-8" \
    -d @request.json \
    "//vision.googleapis.com/v1/images:annotate"6。
  • PROJECT_ID:您的 Google Cloud 项目 ID。

HTTP 方法和网址:

POST //vision.googleapis.com/v1/images:annotate

请求 JSON 正文:

{ "requests": [ { "image": { "content": "BASE64_ENCODED_IMAGE" }, "features": [ { "maxResults": RESULTS_INT, "type": "FACE_DETECTION" } ] } ] } 1

如需发送请求,请选择以下方式之一:

curl

注意:以下命令假定您已使用您的用户帐号通过执行 curl -X POST \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "x-goog-user-project: PROJECT_ID" \
-H "Content-Type: application/json; charset=utf-8" \
-d @request.json \
"//vision.googleapis.com/v1/images:annotate"7 或 curl -X POST \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "x-goog-user-project: PROJECT_ID" \
-H "Content-Type: application/json; charset=utf-8" \
-d @request.json \
"//vision.googleapis.com/v1/images:annotate"8 登录 curl -X POST \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "x-goog-user-project: PROJECT_ID" \
-H "Content-Type: application/json; charset=utf-8" \
-d @request.json \
"//vision.googleapis.com/v1/images:annotate"9 CLI,或者使用了 Cloud Shell,这会使您自动登录 curl -X POST \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "x-goog-user-project: PROJECT_ID" \
-H "Content-Type: application/json; charset=utf-8" \
-d @request.json \
"//vision.googleapis.com/v1/images:annotate"9 CLI。您可以执行 $cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred"; "x-goog-user-project" = "PROJECT_ID" }

Invoke-WebRequest `
-Method POST `
-Headers $headers `
-ContentType: "application/json; charset=utf-8" `
-InFile request.json `
-Uri "//vision.googleapis.com/v1/images:annotate" | Select-Object -Expand Content1 来检查当前活跃的帐号。

将请求正文保存在名为 $cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred"; "x-goog-user-project" = "PROJECT_ID" }

Invoke-WebRequest `
-Method POST `
-Headers $headers `
-ContentType: "application/json; charset=utf-8" `
-InFile request.json `
-Uri "//vision.googleapis.com/v1/images:annotate" | Select-Object -Expand Content2 的文件中,然后执行以下命令:

curl -X POST \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "x-goog-user-project: PROJECT_ID" \
-H "Content-Type: application/json; charset=utf-8" \
-d @request.json \
"//vision.googleapis.com/v1/images:annotate"

PowerShell

注意:以下命令假定您已使用您的用户帐号通过执行 curl -X POST \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "x-goog-user-project: PROJECT_ID" \
-H "Content-Type: application/json; charset=utf-8" \
-d @request.json \
"//vision.googleapis.com/v1/images:annotate"7 或 curl -X POST \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "x-goog-user-project: PROJECT_ID" \
-H "Content-Type: application/json; charset=utf-8" \
-d @request.json \
"//vision.googleapis.com/v1/images:annotate"8 登录 curl -X POST \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "x-goog-user-project: PROJECT_ID" \
-H "Content-Type: application/json; charset=utf-8" \
-d @request.json \
"//vision.googleapis.com/v1/images:annotate"9 CLI,或者使用了 Cloud Shell,这会使您自动登录 curl -X POST \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "x-goog-user-project: PROJECT_ID" \
-H "Content-Type: application/json; charset=utf-8" \
-d @request.json \
"//vision.googleapis.com/v1/images:annotate"9 CLI。您可以执行 $cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred"; "x-goog-user-project" = "PROJECT_ID" }

Invoke-WebRequest `
-Method POST `
-Headers $headers `
-ContentType: "application/json; charset=utf-8" `
-InFile request.json `
-Uri "//vision.googleapis.com/v1/images:annotate" | Select-Object -Expand Content1 来检查当前活跃的帐号。

将请求正文保存在名为 $cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred"; "x-goog-user-project" = "PROJECT_ID" }

Invoke-WebRequest `
-Method POST `
-Headers $headers `
-ContentType: "application/json; charset=utf-8" `
-InFile request.json `
-Uri "//vision.googleapis.com/v1/images:annotate" | Select-Object -Expand Content2 的文件中,然后执行以下命令:

$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred"; "x-goog-user-project" = "PROJECT_ID" }

Invoke-WebRequest `
-Method POST `
-Headers $headers `
-ContentType: "application/json; charset=utf-8" `
-InFile request.json `
-Uri "//vision.googleapis.com/v1/images:annotate" | Select-Object -Expand Content

如果请求成功,服务器将返回一个 $cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred"; "x-goog-user-project" = "PROJECT_ID" }

Invoke-WebRequest `
-Method POST `
-Headers $headers `
-ContentType: "application/json; charset=utf-8" `
-InFile request.json `
-Uri "//vision.googleapis.com/v1/images:annotate" | Select-Object -Expand Content9 HTTP 状态代码以及 JSON 格式的响应。

{ "responses": [ { "faceAnnotations": [ { "boundingPoly": { "vertices": [ { "x": 1077, "y": 157 }, { "x": 2146, "y": 157 }, { "x": 2146, "y": 1399 }, { "x": 1077, "y": 1399 } ] }, "fdBoundingPoly": { "vertices": [ { "x": 1112, "y": 407 }, { "x": 1946, "y": 407 }, { "x": 1946, "y": 1270 }, { "x": 1112, "y": 1270 } ] }, "landmarks": [ { "type": "LEFT_EYE", "position": { "x": 1368.748, "y": 739.0957, "z": 0.0024604797 } }, { "type": "RIGHT_EYE", "position": { "x": 1660.6105, "y": 751.5844, "z": -117.06496 } }, { "type": "LEFT_OF_LEFT_EYEBROW", "position": { "x": 1284.3208, "y": 666.61487, "z": 63.41506 } }, { "type": "RIGHT_OF_LEFT_EYEBROW", "position": { "x": 1418.9249, "y": 671.49414, "z": -83.82396 } }, { "type": "LEFT_OF_RIGHT_EYEBROW", "position": { "x": 1556.9579, "y": 672.2199, "z": -139.39935 } }, { "type": "RIGHT_OF_RIGHT_EYEBROW", "position": { "x": 1771.4799, "y": 682.65845, "z": -131.66716 } }, { "type": "MIDPOINT_BETWEEN_EYES", "position": { "x": 1479.6194, "y": 741.87305, "z": -114.84635 } }, { "type": "NOSE_TIP", "position": { "x": 1443.3151, "y": 917.5109, "z": -194.49301 } }, { "type": "UPPER_LIP", "position": { "x": 1466.7897, "y": 1025.3483, "z": -130.1202 } }, { "type": "LOWER_LIP", "position": { "x": 1467.2588, "y": 1147.0403, "z": -109.24505 } }, { "type": "MOUTH_LEFT", "position": { "x": 1376.8649, "y": 1066.0856, "z": -6.8136826 } }, { "type": "MOUTH_RIGHT", "position": { "x": 1652, "y": 1079.3108, "z": -106.93649 } }, { "type": "MOUTH_CENTER", "position": { "x": 1485.5554, "y": 1087.2388, "z": -110.68126 } }, { "type": "NOSE_BOTTOM_RIGHT", "position": { "x": 1571.9475, "y": 944.9213, "z": -124.11806 } }, { "type": "NOSE_BOTTOM_LEFT", "position": { "x": 1395.2339, "y": 938.12787, "z": -58.072197 } }, { "type": "NOSE_BOTTOM_CENTER", "position": { "x": 1468.4205, "y": 968.8732, "z": -132.09975 } }, { "type": "LEFT_EYE_TOP_BOUNDARY", "position": { "x": 1357.8658, "y": 711.2427, "z": -14.618992 } }, { "type": "LEFT_EYE_RIGHT_CORNER", "position": { "x": 1423.6936, "y": 750.4164, "z": -23.540215 } }, { "type": "LEFT_EYE_BOTTOM_BOUNDARY", "position": { "x": 1360.5627, "y": 762.87415, "z": -1.2607727 } }, { "type": "LEFT_EYE_LEFT_CORNER", "position": { "x": 1313.72, "y": 739.443, "z": 50.216393 } }, { "type": "RIGHT_EYE_TOP_BOUNDARY", "position": { "x": 1661.6622, "y": 718.6839, "z": -134.17404 } }, { "type": "RIGHT_EYE_RIGHT_CORNER", "position": { "x": 1730.0901, "y": 763.57104, "z": -116.365845 } }, { "type": "RIGHT_EYE_BOTTOM_BOUNDARY", "position": { "x": 1660.8823, "y": 777.3474, "z": -120.8635 } }, { "type": "RIGHT_EYE_LEFT_CORNER", "position": { "x": 1590.8903, "y": 753.5044, "z": -91.84842 } }, { "type": "LEFT_EYEBROW_UPPER_MIDPOINT", "position": { "x": 1345.7522, "y": 640.18243, "z": -27.887913 } }, { "type": "RIGHT_EYEBROW_UPPER_MIDPOINT", "position": { "x": 1660.5848, "y": 648.36145, "z": -153.73691 } }, { "type": "LEFT_EAR_TRAGION", "position": { "x": 1274.1006, "y": 826.2645, "z": 422.6642 } }, { "type": "RIGHT_EAR_TRAGION", "position": { "x": 2014.8041, "y": 908.56537, "z": 149.61232 } }, { "type": "FOREHEAD_GLABELLA", "position": { "x": 1476.2395, "y": 669.9625, "z": -120.59111 } }, { "type": "CHIN_GNATHION", "position": { "x": 1477.3256, "y": 1269.3269, "z": -67.748795 } }, { "type": "CHIN_LEFT_GONION", "position": { "x": 1336.8848, "y": 1096.2242, "z": 286.73004 } }, { "type": "CHIN_RIGHT_GONION", "position": { "x": 1863.2197, "y": 1128.6213, "z": 68.90431 } }, { "type": "LEFT_CHEEK_CENTER", "position": { "x": 1317.8549, "y": 940.8025, "z": 50.863163 } }, { "type": "RIGHT_CHEEK_CENTER", "position": { "x": 1733.4912, "y": 964.073, "z": -112.43947 } } ], "rollAngle": 1.5912293, "panAngle": -22.01964, "tiltAngle": -1.4997566, "detectionConfidence": 0.9310801, "landmarkingConfidence": 0.5775582, "joyLikelihood": "VERY_LIKELY", "sorrowLikelihood": "VERY_UNLIKELY", "angerLikelihood": "VERY_UNLIKELY", "surpriseLikelihood": "VERY_UNLIKELY", "underExposedLikelihood": "VERY_UNLIKELY", "blurredLikelihood": "VERY_UNLIKELY", "headwearLikelihood": "POSSIBLE" }, { "boundingPoly": { "vertices": [ { "x": 144, "y": 1273 }, { "x": 793, "y": 1273 }, { "x": 793, "y": 1844 }, { "x": 144, "y": 1844 } ] }, "fdBoundingPoly": { "vertices": [ { "x": 181, "y": 1373 }, { "x": 742, "y": 1373 }, { "x": 742, "y": 1844 }, { "x": 181, "y": 1844 } ] }, "landmarks": [ { "type": "LEFT_EYE", "position": { "x": 356.13745, "y": 1635.7034, "z": 0.0045757294 } }, { "type": "RIGHT_EYE", "position": { "x": 557.07324, "y": 1601.1769, "z": -10.258446 } }, { "type": "LEFT_OF_LEFT_EYEBROW", "position": { "x": 284.70563, "y": 1599.5238, "z": 28.755493 } }, { "type": "RIGHT_OF_LEFT_EYEBROW", "position": { "x": 397.47183, "y": 1574.1455, "z": -28.716581 } }, { "type": "LEFT_OF_RIGHT_EYEBROW", "position": { "x": 484.00983, "y": 1559.5669, "z": -33.509003 } }, { "type": "RIGHT_OF_RIGHT_EYEBROW", "position": { "x": 607.31726, "y": 1551.2396, "z": 11.0225525 } }, { "type": "MIDPOINT_BETWEEN_EYES", "position": { "x": 447.86597, "y": 1603.2458, "z": -40.69277 } }, { "type": "NOSE_TIP", "position": { "x": 463.15356, "y": 1705.7849, "z": -114.36831 } }, { "type": "UPPER_LIP", "position": { "x": 475.02646, "y": 1779.54, "z": -85.219086 } }, { "type": "LOWER_LIP", "position": { "x": 483.2983, "y": 1844.4594, "z": -83.812 } }, { "type": "MOUTH_LEFT", "position": { "x": 391.11206, "y": 1824.9432, "z": -34.578503 } }, { "type": "MOUTH_RIGHT", "position": { "x": 559.85266, "y": 1797.929, "z": -44.700863 } }, { "type": "MOUTH_CENTER", "position": { "x": 478.21106, "y": 1807.5089, "z": -76.46759 } }, { "type": "NOSE_BOTTOM_RIGHT", "position": { "x": 522.9539, "y": 1717.8636, "z": -51.489075 } }, { "type": "NOSE_BOTTOM_LEFT", "position": { "x": 414.95767, "y": 1739.2955, "z": -46.75015 } }, { "type": "NOSE_BOTTOM_CENTER", "position": { "x": 468.7361, "y": 1739.5958, "z": -78.64168 } }, { "type": "LEFT_EYE_TOP_BOUNDARY", "position": { "x": 352.39365, "y": 1618.0576, "z": -7.2005444 } }, { "type": "LEFT_EYE_RIGHT_CORNER", "position": { "x": 395.81454, "y": 1629.9379, "z": -2.4021797 } }, { "type": "LEFT_EYE_BOTTOM_BOUNDARY", "position": { "x": 357.511, "y": 1649.6553, "z": -4.4735374 } }, { "type": "LEFT_EYE_LEFT_CORNER", "position": { "x": 316.1426, "y": 1645.2771, "z": 18.701395 } }, { "type": "RIGHT_EYE_TOP_BOUNDARY", "position": { "x": 553.78973, "y": 1582.3448, "z": -17.07942 } }, { "type": "RIGHT_EYE_RIGHT_CORNER", "position": { "x": 596.6489, "y": 1599.1897, "z": 4.014868 } }, { "type": "RIGHT_EYE_BOTTOM_BOUNDARY", "position": { "x": 558.60706, "y": 1615.964, "z": -15.077105 } }, { "type": "RIGHT_EYE_LEFT_CORNER", "position": { "x": 514.8054, "y": 1605.6407, "z": -7.929638 } }, { "type": "LEFT_EYEBROW_UPPER_MIDPOINT", "position": { "x": 336.4973, "y": 1567.6466, "z": -7.853897 } }, { "type": "RIGHT_EYEBROW_UPPER_MIDPOINT", "position": { "x": 542.3708, "y": 1536.191, "z": -19.405855 } }, { "type": "LEFT_EAR_TRAGION", "position": { "x": 231.38948, "y": 1749.3823, "z": 221.4534 } }, { "type": "RIGHT_EAR_TRAGION", "position": { "x": 712.5644, "y": 1670.4897, "z": 199.4929 } }, { "type": "FOREHEAD_GLABELLA", "position": { "x": 439.35938, "y": 1561.1454, "z": -36.451645 } }, { "type": "CHIN_GNATHION", "position": { "x": 501.61096, "y": 1942.0133, "z": -75.04764 } }, { "type": "CHIN_LEFT_GONION", "position": { "x": 304.9834, "y": 1892.5361, "z": 114.12407 } }, { "type": "CHIN_RIGHT_GONION", "position": { "x": 684.92535, "y": 1824.337, "z": 96.13425 } }, { "type": "LEFT_CHEEK_CENTER", "position": { "x": 334.5645, "y": 1764.659, "z": -2.0755844 } }, { "type": "RIGHT_CHEEK_CENTER", "position": { "x": 609.5919, "y": 1719.6847, "z": -16.861538 } } ], "rollAngle": -8.514851, "panAngle": -3.096844, "tiltAngle": 9.26052, "detectionConfidence": 0.5463216, "landmarkingConfidence": 0.55711126, "joyLikelihood": "VERY_UNLIKELY", "sorrowLikelihood": "VERY_UNLIKELY", "angerLikelihood": "VERY_UNLIKELY", "surpriseLikelihood": "VERY_UNLIKELY", "underExposedLikelihood": "VERY_UNLIKELY", "blurredLikelihood": "UNLIKELY", "headwearLikelihood": "VERY_UNLIKELY" }, { "boundingPoly": { "vertices": [ { "x": 785, "y": 167 }, { "x": 1100, "y": 167 }, { "x": 1100, "y": 534 }, { "x": 785, "y": 534 } ] }, "fdBoundingPoly": { "vertices": [ { "x": 834, "y": 220 }, { "x": 1101, "y": 220 }, { "x": 1101, "y": 506 }, { "x": 834, "y": 506 } ] }, "landmarks": [ { "type": "LEFT_EYE", "position": { "x": 933.74615, "y": 351.82394, "z": -0.00068986416 } }, { "type": "RIGHT_EYE", "position": { "x": 1005.8836, "y": 329.02396, "z": 43.38338 } }, { "type": "LEFT_OF_LEFT_EYEBROW", "position": { "x": 901.93494, "y": 333.3503, "z": -9.714935 } }, { "type": "RIGHT_OF_LEFT_EYEBROW", "position": { "x": 957.4015, "y": 319.9436, "z": -6.8983736 } }, { "type": "LEFT_OF_RIGHT_EYEBROW", "position": { "x": 987.50134, "y": 308.46817, "z": 13.108145 } }, { "type": "RIGHT_OF_RIGHT_EYEBROW", "position": { "x": 1031.5519, "y": 298.8843, "z": 65.60683 } }, { "type": "MIDPOINT_BETWEEN_EYES", "position": { "x": 979.4568, "y": 336.0551, "z": 3.8077774 } }, { "type": "NOSE_TIP", "position": { "x": 1003.45795, "y": 398.80377, "z": -17.351936 } }, { "type": "UPPER_LIP", "position": { "x": 1000.16614, "y": 432.11664, "z": 5.2740355 } }, { "type": "LOWER_LIP", "position": { "x": 1004.0378, "y": 456.92422, "z": 13.545323 } }, { "type": "MOUTH_LEFT", "position": { "x": 961.922, "y": 448.64325, "z": 11.117096 } }, { "type": "MOUTH_RIGHT", "position": { "x": 1025.2979, "y": 432.70157, "z": 47.89795 } }, { "type": "MOUTH_CENTER", "position": { "x": 1002.51434, "y": 443.3482, "z": 13.021965 } }, { "type": "NOSE_BOTTOM_RIGHT", "position": { "x": 1015.5027, "y": 402.8421, "z": 28.03568 } }, { "type": "NOSE_BOTTOM_LEFT", "position": { "x": 969.764, "y": 413.05563, "z": 3.1156778 } }, { "type": "NOSE_BOTTOM_CENTER", "position": { "x": 997.8564, "y": 416.98083, "z": 3.3404813 } }, { "type": "LEFT_EYE_TOP_BOUNDARY", "position": { "x": 930.542, "y": 343.17078, "z": -6.9020395 } }, { "type": "LEFT_EYE_RIGHT_CORNER", "position": { "x": 950.7726, "y": 348.11346, "z": 9.216144 } }, { "type": "LEFT_EYE_BOTTOM_BOUNDARY", "position": { "x": 933.6862, "y": 359.50848, "z": -1.3347243 } }, { "type": "LEFT_EYE_LEFT_CORNER", "position": { "x": 914.83966, "y": 356.1447, "z": -1.4299142 } }, { "type": "RIGHT_EYE_TOP_BOUNDARY", "position": { "x": 1006.59766, "y": 319.50406, "z": 38.31219 } }, { "type": "RIGHT_EYE_RIGHT_CORNER", "position": { "x": 1021.45886, "y": 327.68784, "z": 61.100002 } }, { "type": "RIGHT_EYE_BOTTOM_BOUNDARY", "position": { "x": 1009.46686, "y": 336.0832, "z": 43.87975 } }, { "type": "RIGHT_EYE_LEFT_CORNER", "position": { "x": 991.17535, "y": 331.97632, "z": 34.4881 } }, { "type": "LEFT_EYEBROW_UPPER_MIDPOINT", "position": { "x": 928.40436, "y": 317.13898, "z": -14.411907 } }, { "type": "RIGHT_EYEBROW_UPPER_MIDPOINT", "position": { "x": 1008.5887, "y": 294.364, "z": 32.917953 } }, { "type": "LEFT_EAR_TRAGION", "position": { "x": 835.18915, "y": 395.7093, "z": 81.31065 } }, { "type": "RIGHT_EAR_TRAGION", "position": { "x": 1024.4136, "y": 360.64178, "z": 182.02446 } }, { "type": "FOREHEAD_GLABELLA", "position": { "x": 975.5221, "y": 315.06647, "z": 0.31154716 } }, { "type": "CHIN_GNATHION", "position": { "x": 1010.74097, "y": 503.23572, "z": 29.966637 } }, { "type": "CHIN_LEFT_GONION", "position": { "x": 891.86237, "y": 466.7829, "z": 58.84553 } }, { "type": "CHIN_RIGHT_GONION", "position": { "x": 1031.9008, "y": 428.13455, "z": 145.42484 } }, { "type": "LEFT_CHEEK_CENTER", "position": { "x": 929.4197, "y": 418.09122, "z": 4.574672 } }, { "type": "RIGHT_CHEEK_CENTER", "position": { "x": 1033.7278, "y": 390.5432, "z": 65.6329 } } ], "rollAngle": -12.077273, "panAngle": 27.194477, "tiltAngle": -5.252778, "detectionConfidence": 0.38126788, "landmarkingConfidence": 0.040030442, "joyLikelihood": "VERY_UNLIKELY", "sorrowLikelihood": "VERY_UNLIKELY", "angerLikelihood": "VERY_UNLIKELY", "surpriseLikelihood": "VERY_UNLIKELY", "underExposedLikelihood": "LIKELY", "blurredLikelihood": "VERY_LIKELY", "headwearLikelihood": "VERY_UNLIKELY" } ] } ] } 0 响应包括检测到的所有人脸的边界框、在人脸上检测到的重要部位(眼睛、鼻子、嘴巴等)及人脸和图片属性(喜悦、悲伤、愤怒、惊奇等)的置信度评分。

响应

{ "responses": [ { "faceAnnotations": [ { "boundingPoly": { "vertices": [ { "x": 1077, "y": 157 }, { "x": 2146, "y": 157 }, { "x": 2146, "y": 1399 }, { "x": 1077, "y": 1399 } ] }, "fdBoundingPoly": { "vertices": [ { "x": 1112, "y": 407 }, { "x": 1946, "y": 407 }, { "x": 1946, "y": 1270 }, { "x": 1112, "y": 1270 } ] }, "landmarks": [ { "type": "LEFT_EYE", "position": { "x": 1368.748, "y": 739.0957, "z": 0.0024604797 } }, { "type": "RIGHT_EYE", "position": { "x": 1660.6105, "y": 751.5844, "z": -117.06496 } }, { "type": "LEFT_OF_LEFT_EYEBROW", "position": { "x": 1284.3208, "y": 666.61487, "z": 63.41506 } }, { "type": "RIGHT_OF_LEFT_EYEBROW", "position": { "x": 1418.9249, "y": 671.49414, "z": -83.82396 } }, { "type": "LEFT_OF_RIGHT_EYEBROW", "position": { "x": 1556.9579, "y": 672.2199, "z": -139.39935 } }, { "type": "RIGHT_OF_RIGHT_EYEBROW", "position": { "x": 1771.4799, "y": 682.65845, "z": -131.66716 } }, { "type": "MIDPOINT_BETWEEN_EYES", "position": { "x": 1479.6194, "y": 741.87305, "z": -114.84635 } }, { "type": "NOSE_TIP", "position": { "x": 1443.3151, "y": 917.5109, "z": -194.49301 } }, { "type": "UPPER_LIP", "position": { "x": 1466.7897, "y": 1025.3483, "z": -130.1202 } }, { "type": "LOWER_LIP", "position": { "x": 1467.2588, "y": 1147.0403, "z": -109.24505 } }, { "type": "MOUTH_LEFT", "position": { "x": 1376.8649, "y": 1066.0856, "z": -6.8136826 } }, { "type": "MOUTH_RIGHT", "position": { "x": 1652, "y": 1079.3108, "z": -106.93649 } }, { "type": "MOUTH_CENTER", "position": { "x": 1485.5554, "y": 1087.2388, "z": -110.68126 } }, { "type": "NOSE_BOTTOM_RIGHT", "position": { "x": 1571.9475, "y": 944.9213, "z": -124.11806 } }, { "type": "NOSE_BOTTOM_LEFT", "position": { "x": 1395.2339, "y": 938.12787, "z": -58.072197 } }, { "type": "NOSE_BOTTOM_CENTER", "position": { "x": 1468.4205, "y": 968.8732, "z": -132.09975 } }, { "type": "LEFT_EYE_TOP_BOUNDARY", "position": { "x": 1357.8658, "y": 711.2427, "z": -14.618992 } }, { "type": "LEFT_EYE_RIGHT_CORNER", "position": { "x": 1423.6936, "y": 750.4164, "z": -23.540215 } }, { "type": "LEFT_EYE_BOTTOM_BOUNDARY", "position": { "x": 1360.5627, "y": 762.87415, "z": -1.2607727 } }, { "type": "LEFT_EYE_LEFT_CORNER", "position": { "x": 1313.72, "y": 739.443, "z": 50.216393 } }, { "type": "RIGHT_EYE_TOP_BOUNDARY", "position": { "x": 1661.6622, "y": 718.6839, "z": -134.17404 } }, { "type": "RIGHT_EYE_RIGHT_CORNER", "position": { "x": 1730.0901, "y": 763.57104, "z": -116.365845 } }, { "type": "RIGHT_EYE_BOTTOM_BOUNDARY", "position": { "x": 1660.8823, "y": 777.3474, "z": -120.8635 } }, { "type": "RIGHT_EYE_LEFT_CORNER", "position": { "x": 1590.8903, "y": 753.5044, "z": -91.84842 } }, { "type": "LEFT_EYEBROW_UPPER_MIDPOINT", "position": { "x": 1345.7522, "y": 640.18243, "z": -27.887913 } }, { "type": "RIGHT_EYEBROW_UPPER_MIDPOINT", "position": { "x": 1660.5848, "y": 648.36145, "z": -153.73691 } }, { "type": "LEFT_EAR_TRAGION", "position": { "x": 1274.1006, "y": 826.2645, "z": 422.6642 } }, { "type": "RIGHT_EAR_TRAGION", "position": { "x": 2014.8041, "y": 908.56537, "z": 149.61232 } }, { "type": "FOREHEAD_GLABELLA", "position": { "x": 1476.2395, "y": 669.9625, "z": -120.59111 } }, { "type": "CHIN_GNATHION", "position": { "x": 1477.3256, "y": 1269.3269, "z": -67.748795 } }, { "type": "CHIN_LEFT_GONION", "position": { "x": 1336.8848, "y": 1096.2242, "z": 286.73004 } }, { "type": "CHIN_RIGHT_GONION", "position": { "x": 1863.2197, "y": 1128.6213, "z": 68.90431 } }, { "type": "LEFT_CHEEK_CENTER", "position": { "x": 1317.8549, "y": 940.8025, "z": 50.863163 } }, { "type": "RIGHT_CHEEK_CENTER", "position": { "x": 1733.4912, "y": 964.073, "z": -112.43947 } } ], "rollAngle": 1.5912293, "panAngle": -22.01964, "tiltAngle": -1.4997566, "detectionConfidence": 0.9310801, "landmarkingConfidence": 0.5775582, "joyLikelihood": "VERY_LIKELY", "sorrowLikelihood": "VERY_UNLIKELY", "angerLikelihood": "VERY_UNLIKELY", "surpriseLikelihood": "VERY_UNLIKELY", "underExposedLikelihood": "VERY_UNLIKELY", "blurredLikelihood": "VERY_UNLIKELY", "headwearLikelihood": "POSSIBLE" }, { "boundingPoly": { "vertices": [ { "x": 144, "y": 1273 }, { "x": 793, "y": 1273 }, { "x": 793, "y": 1844 }, { "x": 144, "y": 1844 } ] }, "fdBoundingPoly": { "vertices": [ { "x": 181, "y": 1373 }, { "x": 742, "y": 1373 }, { "x": 742, "y": 1844 }, { "x": 181, "y": 1844 } ] }, "landmarks": [ { "type": "LEFT_EYE", "position": { "x": 356.13745, "y": 1635.7034, "z": 0.0045757294 } }, { "type": "RIGHT_EYE", "position": { "x": 557.07324, "y": 1601.1769, "z": -10.258446 } }, { "type": "LEFT_OF_LEFT_EYEBROW", "position": { "x": 284.70563, "y": 1599.5238, "z": 28.755493 } }, { "type": "RIGHT_OF_LEFT_EYEBROW", "position": { "x": 397.47183, "y": 1574.1455, "z": -28.716581 } }, { "type": "LEFT_OF_RIGHT_EYEBROW", "position": { "x": 484.00983, "y": 1559.5669, "z": -33.509003 } }, { "type": "RIGHT_OF_RIGHT_EYEBROW", "position": { "x": 607.31726, "y": 1551.2396, "z": 11.0225525 } }, { "type": "MIDPOINT_BETWEEN_EYES", "position": { "x": 447.86597, "y": 1603.2458, "z": -40.69277 } }, { "type": "NOSE_TIP", "position": { "x": 463.15356, "y": 1705.7849, "z": -114.36831 } }, { "type": "UPPER_LIP", "position": { "x": 475.02646, "y": 1779.54, "z": -85.219086 } }, { "type": "LOWER_LIP", "position": { "x": 483.2983, "y": 1844.4594, "z": -83.812 } }, { "type": "MOUTH_LEFT", "position": { "x": 391.11206, "y": 1824.9432, "z": -34.578503 } }, { "type": "MOUTH_RIGHT", "position": { "x": 559.85266, "y": 1797.929, "z": -44.700863 } }, { "type": "MOUTH_CENTER", "position": { "x": 478.21106, "y": 1807.5089, "z": -76.46759 } }, { "type": "NOSE_BOTTOM_RIGHT", "position": { "x": 522.9539, "y": 1717.8636, "z": -51.489075 } }, { "type": "NOSE_BOTTOM_LEFT", "position": { "x": 414.95767, "y": 1739.2955, "z": -46.75015 } }, { "type": "NOSE_BOTTOM_CENTER", "position": { "x": 468.7361, "y": 1739.5958, "z": -78.64168 } }, { "type": "LEFT_EYE_TOP_BOUNDARY", "position": { "x": 352.39365, "y": 1618.0576, "z": -7.2005444 } }, { "type": "LEFT_EYE_RIGHT_CORNER", "position": { "x": 395.81454, "y": 1629.9379, "z": -2.4021797 } }, { "type": "LEFT_EYE_BOTTOM_BOUNDARY", "position": { "x": 357.511, "y": 1649.6553, "z": -4.4735374 } }, { "type": "LEFT_EYE_LEFT_CORNER", "position": { "x": 316.1426, "y": 1645.2771, "z": 18.701395 } }, { "type": "RIGHT_EYE_TOP_BOUNDARY", "position": { "x": 553.78973, "y": 1582.3448, "z": -17.07942 } }, { "type": "RIGHT_EYE_RIGHT_CORNER", "position": { "x": 596.6489, "y": 1599.1897, "z": 4.014868 } }, { "type": "RIGHT_EYE_BOTTOM_BOUNDARY", "position": { "x": 558.60706, "y": 1615.964, "z": -15.077105 } }, { "type": "RIGHT_EYE_LEFT_CORNER", "position": { "x": 514.8054, "y": 1605.6407, "z": -7.929638 } }, { "type": "LEFT_EYEBROW_UPPER_MIDPOINT", "position": { "x": 336.4973, "y": 1567.6466, "z": -7.853897 } }, { "type": "RIGHT_EYEBROW_UPPER_MIDPOINT", "position": { "x": 542.3708, "y": 1536.191, "z": -19.405855 } }, { "type": "LEFT_EAR_TRAGION", "position": { "x": 231.38948, "y": 1749.3823, "z": 221.4534 } }, { "type": "RIGHT_EAR_TRAGION", "position": { "x": 712.5644, "y": 1670.4897, "z": 199.4929 } }, { "type": "FOREHEAD_GLABELLA", "position": { "x": 439.35938, "y": 1561.1454, "z": -36.451645 } }, { "type": "CHIN_GNATHION", "position": { "x": 501.61096, "y": 1942.0133, "z": -75.04764 } }, { "type": "CHIN_LEFT_GONION", "position": { "x": 304.9834, "y": 1892.5361, "z": 114.12407 } }, { "type": "CHIN_RIGHT_GONION", "position": { "x": 684.92535, "y": 1824.337, "z": 96.13425 } }, { "type": "LEFT_CHEEK_CENTER", "position": { "x": 334.5645, "y": 1764.659, "z": -2.0755844 } }, { "type": "RIGHT_CHEEK_CENTER", "position": { "x": 609.5919, "y": 1719.6847, "z": -16.861538 } } ], "rollAngle": -8.514851, "panAngle": -3.096844, "tiltAngle": 9.26052, "detectionConfidence": 0.5463216, "landmarkingConfidence": 0.55711126, "joyLikelihood": "VERY_UNLIKELY", "sorrowLikelihood": "VERY_UNLIKELY", "angerLikelihood": "VERY_UNLIKELY", "surpriseLikelihood": "VERY_UNLIKELY", "underExposedLikelihood": "VERY_UNLIKELY", "blurredLikelihood": "UNLIKELY", "headwearLikelihood": "VERY_UNLIKELY" }, { "boundingPoly": { "vertices": [ { "x": 785, "y": 167 }, { "x": 1100, "y": 167 }, { "x": 1100, "y": 534 }, { "x": 785, "y": 534 } ] }, "fdBoundingPoly": { "vertices": [ { "x": 834, "y": 220 }, { "x": 1101, "y": 220 }, { "x": 1101, "y": 506 }, { "x": 834, "y": 506 } ] }, "landmarks": [ { "type": "LEFT_EYE", "position": { "x": 933.74615, "y": 351.82394, "z": -0.00068986416 } }, { "type": "RIGHT_EYE", "position": { "x": 1005.8836, "y": 329.02396, "z": 43.38338 } }, { "type": "LEFT_OF_LEFT_EYEBROW", "position": { "x": 901.93494, "y": 333.3503, "z": -9.714935 } }, { "type": "RIGHT_OF_LEFT_EYEBROW", "position": { "x": 957.4015, "y": 319.9436, "z": -6.8983736 } }, { "type": "LEFT_OF_RIGHT_EYEBROW", "position": { "x": 987.50134, "y": 308.46817, "z": 13.108145 } }, { "type": "RIGHT_OF_RIGHT_EYEBROW", "position": { "x": 1031.5519, "y": 298.8843, "z": 65.60683 } }, { "type": "MIDPOINT_BETWEEN_EYES", "position": { "x": 979.4568, "y": 336.0551, "z": 3.8077774 } }, { "type": "NOSE_TIP", "position": { "x": 1003.45795, "y": 398.80377, "z": -17.351936 } }, { "type": "UPPER_LIP", "position": { "x": 1000.16614, "y": 432.11664, "z": 5.2740355 } }, { "type": "LOWER_LIP", "position": { "x": 1004.0378, "y": 456.92422, "z": 13.545323 } }, { "type": "MOUTH_LEFT", "position": { "x": 961.922, "y": 448.64325, "z": 11.117096 } }, { "type": "MOUTH_RIGHT", "position": { "x": 1025.2979, "y": 432.70157, "z": 47.89795 } }, { "type": "MOUTH_CENTER", "position": { "x": 1002.51434, "y": 443.3482, "z": 13.021965 } }, { "type": "NOSE_BOTTOM_RIGHT", "position": { "x": 1015.5027, "y": 402.8421, "z": 28.03568 } }, { "type": "NOSE_BOTTOM_LEFT", "position": { "x": 969.764, "y": 413.05563, "z": 3.1156778 } }, { "type": "NOSE_BOTTOM_CENTER", "position": { "x": 997.8564, "y": 416.98083, "z": 3.3404813 } }, { "type": "LEFT_EYE_TOP_BOUNDARY", "position": { "x": 930.542, "y": 343.17078, "z": -6.9020395 } }, { "type": "LEFT_EYE_RIGHT_CORNER", "position": { "x": 950.7726, "y": 348.11346, "z": 9.216144 } }, { "type": "LEFT_EYE_BOTTOM_BOUNDARY", "position": { "x": 933.6862, "y": 359.50848, "z": -1.3347243 } }, { "type": "LEFT_EYE_LEFT_CORNER", "position": { "x": 914.83966, "y": 356.1447, "z": -1.4299142 } }, { "type": "RIGHT_EYE_TOP_BOUNDARY", "position": { "x": 1006.59766, "y": 319.50406, "z": 38.31219 } }, { "type": "RIGHT_EYE_RIGHT_CORNER", "position": { "x": 1021.45886, "y": 327.68784, "z": 61.100002 } }, { "type": "RIGHT_EYE_BOTTOM_BOUNDARY", "position": { "x": 1009.46686, "y": 336.0832, "z": 43.87975 } }, { "type": "RIGHT_EYE_LEFT_CORNER", "position": { "x": 991.17535, "y": 331.97632, "z": 34.4881 } }, { "type": "LEFT_EYEBROW_UPPER_MIDPOINT", "position": { "x": 928.40436, "y": 317.13898, "z": -14.411907 } }, { "type": "RIGHT_EYEBROW_UPPER_MIDPOINT", "position": { "x": 1008.5887, "y": 294.364, "z": 32.917953 } }, { "type": "LEFT_EAR_TRAGION", "position": { "x": 835.18915, "y": 395.7093, "z": 81.31065 } }, { "type": "RIGHT_EAR_TRAGION", "position": { "x": 1024.4136, "y": 360.64178, "z": 182.02446 } }, { "type": "FOREHEAD_GLABELLA", "position": { "x": 975.5221, "y": 315.06647, "z": 0.31154716 } }, { "type": "CHIN_GNATHION", "position": { "x": 1010.74097, "y": 503.23572, "z": 29.966637 } }, { "type": "CHIN_LEFT_GONION", "position": { "x": 891.86237, "y": 466.7829, "z": 58.84553 } }, { "type": "CHIN_RIGHT_GONION", "position": { "x": 1031.9008, "y": 428.13455, "z": 145.42484 } }, { "type": "LEFT_CHEEK_CENTER", "position": { "x": 929.4197, "y": 418.09122, "z": 4.574672 } }, { "type": "RIGHT_CHEEK_CENTER", "position": { "x": 1033.7278, "y": 390.5432, "z": 65.6329 } } ], "rollAngle": -12.077273, "panAngle": 27.194477, "tiltAngle": -5.252778, "detectionConfidence": 0.38126788, "landmarkingConfidence": 0.040030442, "joyLikelihood": "VERY_UNLIKELY", "sorrowLikelihood": "VERY_UNLIKELY", "angerLikelihood": "VERY_UNLIKELY", "surpriseLikelihood": "VERY_UNLIKELY", "underExposedLikelihood": "LIKELY", "blurredLikelihood": "VERY_LIKELY", "headwearLikelihood": "VERY_UNLIKELY" } ] } ] }

Go

试用此示例之前,请按照《Vision 快速入门:使用客户端库》中的 Go 设置说明进行操作。如需了解详情,请参阅 Vision Go API 参考文档。

在 GitHub 上查看 反馈

{ "requests": [ { "image": { "content": "BASE64_ENCODED_IMAGE" }, "features": [ { "maxResults": RESULTS_INT, "type": "FACE_DETECTION" } ] } ] } 5

Java

在试用此示例之前,请按照Vision API 快速入门:使用客户端库中的 Java 设置说明进行操作。如需了解详情,请参阅 Vision API Java 参考文档。

注意:对于 Java Spring 框架用户,Spring Cloud Google Cloud 提供了一种身份验证设置和客户端对象的自动配置方法来使用 Vision API。

在 GitHub 上查看 反馈

{ "requests": [ { "image": { "content": "BASE64_ENCODED_IMAGE" }, "features": [ { "maxResults": RESULTS_INT, "type": "FACE_DETECTION" } ] } ] } 6

Node.js

试用此示例之前,请按照《Vision 快速入门:使用客户端库》中的 Node.js 设置说明进行操作。如需了解详情,请参阅 Vision Node.js API 参考文档。

在 GitHub 上查看 反馈

{ "requests": [ { "image": { "content": "BASE64_ENCODED_IMAGE" }, "features": [ { "maxResults": RESULTS_INT, "type": "FACE_DETECTION" } ] } ] } 7

Python

试用此示例之前,请按照《Vision 快速入门:使用客户端库》中的 Python 设置说明进行操作。如需了解详情,请参阅 Vision Python API 参考文档。

在 GitHub 上查看 反馈

{ "requests": [ { "image": { "content": "BASE64_ENCODED_IMAGE" }, "features": [ { "maxResults": RESULTS_INT, "type": "FACE_DETECTION" } ] } ] } 8

gcloud CLI

如需执行人脸检测,请使用 // detectFaces gets faces from the Vision API for an image at the given file path. func detectFaces(w io.Writer, file string) error { ctx := context.Background() client, err := vision.NewImageAnnotatorClient(ctx) if err != nil { return err } defer client.Close() f, err := os.Open(file) if err != nil { return err } defer f.Close() image, err := vision.NewImageFromReader(f) if err != nil { return err } annotations, err := client.DetectFaces(ctx, image, nil, 10) if err != nil { return err } if len(annotations) == 0 { fmt.Fprintln(w, "No faces found.") } else { fmt.Fprintln(w, "Faces:") for i, annotation := range annotations { fmt.Fprintln(w, " Face", i) fmt.Fprintln(w, " Anger:", annotation.AngerLikelihood) fmt.Fprintln(w, " Joy:", annotation.JoyLikelihood) fmt.Fprintln(w, " Surprise:", annotation.SurpriseLikelihood) } } return nil } 9 命令,如以下示例所示:

{ "requests": [ { "image": { "content": "BASE64_ENCODED_IMAGE" }, "features": [ { "maxResults": RESULTS_INT, "type": "FACE_DETECTION" } ] } ] } 9

其他语言

C#: 请按照客户端库页面上的 C# 设置说明操作,然后访问 .NET 版 Vision 参考文档。

PHP: 请按照客户端库页面上的 PHP 设置说明操作,然后访问 PHP 版 Vision 参考文档。

Ruby 版: 请按照客户端库页面上的 Ruby 设置说明操作,然后访问 Ruby 版 Vision 参考文档。

试用

接下来,请尝试执行人脸检测。您可以使用已指定的图片 ( import com.google.cloud.vision.v1.AnnotateImageRequest; import com.google.cloud.vision.v1.AnnotateImageResponse; import com.google.cloud.vision.v1.BatchAnnotateImagesResponse; import com.google.cloud.vision.v1.FaceAnnotation; import com.google.cloud.vision.v1.Feature; import com.google.cloud.vision.v1.Image; import com.google.cloud.vision.v1.ImageAnnotatorClient; import com.google.protobuf.ByteString; import java.io.FileInputStream; import java.io.IOException; import java.util.ArrayList; import java.util.List; public class DetectFaces { public static void detectFaces() throws IOException { // TODO(developer): Replace these variables before running the sample. String filePath = "path/to/your/image/file.jpg"; detectFaces(filePath); } // Detects faces in the specified local image. public static void detectFaces(String filePath) throws IOException { List<AnnotateImageRequest> requests = new ArrayList<>(); ByteString imgBytes = ByteString.readFrom(new FileInputStream(filePath)); Image img = Image.newBuilder().setContent(imgBytes).build(); Feature feat = Feature.newBuilder().setType(Feature.Type.FACE_DETECTION).build(); AnnotateImageRequest request = AnnotateImageRequest.newBuilder().addFeatures(feat).setImage(img).build(); requests.add(request); // Initialize client that will be used to send requests. This client only needs to be created // once, and can be reused for multiple requests. After completing all of your requests, call // the "close" method on the client to safely clean up any remaining background resources. try (ImageAnnotatorClient client = ImageAnnotatorClient.create()) { BatchAnnotateImagesResponse response = client.batchAnnotateImages(requests); List<AnnotateImageResponse> responses = response.getResponsesList(); for (AnnotateImageResponse res : responses) { if (res.hasError()) { System.out.format("Error: %s%n", res.getError().getMessage()); return; } // For full list of available annotations, see //g.co/cloud/vision/docs for (FaceAnnotation annotation : res.getFaceAnnotationsList()) { System.out.format( "anger: %s%njoy: %s%nsurprise: %s%nposition: %s", annotation.getAngerLikelihood(), annotation.getJoyLikelihood(), annotation.getSurpriseLikelihood(), annotation.getBoundingPoly()); } } } } }0) 或指定您自己的图片。选择执行即可发送请求。

请求正文:

curl -X POST \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "x-goog-user-project: PROJECT_ID" \
-H "Content-Type: application/json; charset=utf-8" \
-d @request.json \
"//vision.googleapis.com/v1/images:annotate"0

发送反馈

Toplist

最新的帖子

標籤