AnnotateImageRequest

要求對使用者提供的圖片執行 Google Cloud Vision API 工作,並提供使用者要求的功能和情境資訊。

JSON 表示法
{
  "image": {
    object(Image)
  },
  "features": [
    {
      object(Feature)
    }
  ],
  "imageContext": {
    object(ImageContext)
  },
  "customLabelDetectionModels": [
    string
  ]
}
欄位
image

object(Image)

要處理的圖片。

features[]

object(Feature)

要求的功能。

imageContext

object(ImageContext)

圖片可能附帶的額外背景資訊。

customLabelDetectionModels[]

string

features.type 欄位中提出含有 CUSTOM_LABEL_DETECTION 值的要求時,CustomLabelDetectionModels 欄位必須指定要使用的自訂模型。模型名稱的格式會模仿自訂模型的資源網址:/projects/PROJECT_ID/models/MODEL_ID,如果模型屬於目前專案,則為 /models/MODEL_ID

圖片

用戶端圖片,用於執行 Google Cloud Vision API 工作。

JSON 表示法
{
  "content": string,
  "source": {
    object(ImageSource)
  }
}
欄位
content

string (bytes format)

圖片內容,以位元組串流表示。注意:與所有 bytes 欄位一樣,Protobuffer 使用純二進位表示法,而 JSON 表示法使用 Base64。

Base64 編碼字串。

source

object(ImageSource)

Google Cloud Storage 圖片位置或可公開存取的圖片網址。如果圖片同時提供 contentsource,系統會優先採用 content,並用來執行圖片註解要求。

圖片來源

外部圖片來源 (Google Cloud Storage 或網址圖片位置)。

JSON 表示法
{
  "gcsImageUri": string,
  "imageUri": string
}
欄位
gcsImageUri

string

請改用 imageUri

Google Cloud Storage URI,格式為 gs://bucket_name/object_name。不支援物件版本管理功能。詳情請參閱「Google Cloud Storage 要求 URI」。

imageUri

string

來源圖片的 URI。可以是下列任一項:

  1. 格式為 gs://bucket_name/object_name 的 Google Cloud Storage URI。不支援物件版本管理功能。詳情請參閱「Google Cloud Storage 要求 URI」。

  2. 可公開存取的圖片 HTTP/HTTPS 網址。從 HTTP/HTTPS 網址擷取圖片時,Google 無法保證要求會完成。如果指定主機拒絕要求 (例如因要求節流或防止 DOS 攻擊),或 Google 為防止濫用而節流對網站的要求,您的要求可能會失敗。您不應依賴外部代管圖片來製作應用程式。

如果同時指定 gcsImageUriimageUri,系統會優先採用 imageUri