共用方式為


Image Analysis - Segment

分析輸入影像。 要求包含任何內容類型為 ['image/*'、'application/octet-stream'] 的影像數據流,或包含用來擷取影像數據流的 URL 屬性的 JSON 承載。 會傳回內容類型 'image/png' 的影像數據流,其中圖元值取決於分析模式。 傳回的影像具有與模式輸入影像相同的維度:foregroundMatting。 傳回的影像具有相同的外觀比例和輸入影像的相同維度,模式的限制為 16 MB:backgroundRemoval。

POST /imageanalysis:segment?api-version=2023-02-01-preview
POST /imageanalysis:segment?mode={mode}&api-version=2023-02-01-preview

URI 參數

名稱 位於 必要 類型 Description
api-version
query True

string

要求的 API 版本。

mode
query

SegmentationModeApiModel

所要求的分析模式。 其中一個:backgroundRemoval、foregroundMatting。

要求本文

名稱 必要 類型 Description
url True

string

影像的可公開連線 URL。

回應

名稱 類型 Description
200 OK

file

成功

Media Types: "image/png", "application/json"

Other Status Codes

ErrorResponse

[錯誤]

Media Types: "image/png", "application/json"

標題

x-ms-error-code: string

範例

Segment_BackgroundRemoval_FromImageUrl
Segment_ForegroundMatting_FromImageUrl

Segment_BackgroundRemoval_FromImageUrl

範例要求

POST /imageanalysis:segment?mode=backgroundRemoval&api-version=2023-02-01-preview

{
  "url": "{image url}"
}

範例回覆

"Ynl0ZXM="

Segment_ForegroundMatting_FromImageUrl

範例要求

POST /imageanalysis:segment?mode=foregroundMatting&api-version=2023-02-01-preview

{
  "url": "{image url}"
}

範例回覆

"Ynl0ZXM="

定義

名稱 Description
ErrorResponse

發生錯誤時傳回的回應。

ErrorResponseDetails

錯誤資訊。

ErrorResponseInnerError

詳細的錯誤。

ImageUrl

具有 URL 的 JSON 檔,指向要分析的影像。

SegmentationModeApiModel

所要求的分析模式。 其中一個:backgroundRemoval、foregroundMatting。

ErrorResponse

發生錯誤時傳回的回應。

名稱 類型 Description
error

ErrorResponseDetails

錯誤資訊。

ErrorResponseDetails

錯誤資訊。

名稱 類型 Description
code

string

錯誤碼。

details

ErrorResponseDetails[]

詳細錯誤清單。

innererror

ErrorResponseInnerError

詳細的錯誤。

message

string

錯誤訊息。

target

string

錯誤的目標。

ErrorResponseInnerError

詳細的錯誤。

名稱 類型 Description
code

string

錯誤碼。

innererror

ErrorResponseInnerError

詳細的錯誤。

message

string

錯誤訊息。

ImageUrl

具有 URL 的 JSON 檔,指向要分析的影像。

名稱 類型 Description
url

string

影像的可公開連線 URL。

SegmentationModeApiModel

所要求的分析模式。 其中一個:backgroundRemoval、foregroundMatting。

名稱 類型 Description
backgroundRemoval

string

foregroundMatting

string