Image Analysis - Segment
分析输入图像。 请求要么包含具有任何内容类型 ['image/*', 'application/octet-stream'] 的图像流,要么包含 JSON 有效负载,其中包含用于检索图像流的 URL 属性。 返回了内容类型为“image/png”的图像流,其中像素值取决于分析模式。 对于该模式,返回的图像与输入的图像具有相同的尺寸:foregroundMatting。 对于该模式,返回的图像与输入的图像的纵横比和尺寸相同,最大为 1600 万像素:backgroundRemoval。
POST /imageanalysis:segment?api-version=2023-02-01-preview
POST /imageanalysis:segment?mode={mode}&api-version=2023-02-01-preview
URI 参数
| 名称 | 在 | 必需 | 类型 | 说明 |
|---|---|---|---|---|
|
api-version
|
query | True |
string |
请求的 API 版本。 |
|
mode
|
query |
请求的分析模式。 其中一个:backgroundRemoval、foregroundMatting。 |
请求正文
| 名称 | 必需 | 类型 | 说明 |
|---|---|---|---|
| url | True |
string |
图像的可公开访问 URL。 |
响应
| 名称 | 类型 | 说明 |
|---|---|---|
| 200 OK |
file |
成功 Media Types: "image/png", "application/json" |
| Other Status Codes |
错误 Media Types: "image/png", "application/json" 标头 x-ms-error-code: string |
示例
|
Segment_Background |
|
Segment_Foreground |
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="
定义
| 名称 | 说明 |
|---|---|
|
Error |
发生错误时返回的响应。 |
|
Error |
错误信息。 |
|
Error |
详细错误。 |
|
Image |
一个 JSON 文档,其中包含指向要分析的图像的 URL。 |
|
Segmentation |
请求的分析模式。 其中一个:backgroundRemoval、foregroundMatting。 |
ErrorResponse
发生错误时返回的响应。
| 名称 | 类型 | 说明 |
|---|---|---|
| error |
错误信息。 |
ErrorResponseDetails
错误信息。
| 名称 | 类型 | 说明 |
|---|---|---|
| code |
string |
错误代码。 |
| details |
详细错误列表。 |
|
| innererror |
详细错误。 |
|
| message |
string |
错误信息。 |
| target |
string |
错误的目标。 |
ErrorResponseInnerError
详细错误。
| 名称 | 类型 | 说明 |
|---|---|---|
| code |
string |
错误代码。 |
| innererror |
详细错误。 |
|
| message |
string |
错误信息。 |
ImageUrl
一个 JSON 文档,其中包含指向要分析的图像的 URL。
| 名称 | 类型 | 说明 |
|---|---|---|
| url |
string |
图像的可公开访问 URL。 |
SegmentationModeApiModel
请求的分析模式。 其中一个:backgroundRemoval、foregroundMatting。
| 值 | 说明 |
|---|---|
| backgroundRemoval | |
| foregroundMatting |