Image Analysis - Segment Stream
Analyze the input image. The request either contains an image stream with any content type ['image/*', 'application/octet-stream'], or a JSON payload which includes a url property to be used to retrieve the image stream. An image stream of content type 'image/png' is returned, where the pixel values depend on the analysis mode. The returned image has the same dimensions as the input image for modes: foregroundMatting. The returned image has the same aspect ratio and same dimensions as the input image up to a limit of 16 megapixels for modes: backgroundRemoval.
POST /imageanalysis:segment?overload=stream&api-version=2023-04-01-preview
POST /imageanalysis:segment?overload=stream&mode={mode}&api-version=2023-04-01-preview
URI Parameters
Name | In | Required | Type | Description |
---|---|---|---|---|
api-version
|
query | True |
string |
Requested API version. |
mode
|
query |
The analysis mode requested. |
Request Body
Media Types: "application/octet-stream", "image/jpeg", "image/gif", "image/tiff", "image/bmp", "image/png"
Name | Type | Description |
---|---|---|
body |
string |
An image stream. |
Responses
Name | Type | Description |
---|---|---|
200 OK |
file |
Success Media Types: "image/png", "application/json" |
Other Status Codes |
Error Media Types: "image/png", "application/json" Headers x-ms-error-code: string |
Examples
Segment_Background |
Segment_Foreground |
Segment_BackgroundRemoval_FromImageStream
Sample request
POST /imageanalysis:segment?overload=stream&mode=foregroundMatting&api-version=2023-04-01-preview
"Ynl0ZXM="
Sample response
"Ynl0ZXM="
Segment_ForegroundMatting_FromImageStream
Sample request
POST /imageanalysis:segment?overload=stream&mode=foregroundMatting&api-version=2023-04-01-preview
"Ynl0ZXM="
Sample response
"Ynl0ZXM="
Definitions
Name | Description |
---|---|
Error |
Response returned when an error occurs. |
Error |
Error info. |
Error |
Detailed error. |
Segmentation |
The analysis mode requested. |
ErrorResponse
Response returned when an error occurs.
Name | Type | Description |
---|---|---|
error |
Error info. |
ErrorResponseDetails
Error info.
Name | Type | Description |
---|---|---|
code |
string |
Error code. |
details |
List of detailed errors. |
|
innererror |
Detailed error. |
|
message |
string |
Error message. |
target |
string |
Target of the error. |
ErrorResponseInnerError
Detailed error.
Name | Type | Description |
---|---|---|
code |
string |
Error code. |
innererror |
Detailed error. |
|
message |
string |
Error message. |
SegmentationMode
The analysis mode requested.
Name | Type | Description |
---|---|---|
backgroundRemoval |
string |
|
foregroundMatting |
string |