Get Area Of Interest - Get Area Of Interest

This operation returns a bounding box around the most important area of the image. A successful response will be returned in JSON. If the request failed, the response contains an error code and a message to help determine what went wrong. Upon failure, the error code and an error message are returned. The error code could be one of InvalidImageUrl, InvalidImageFormat, InvalidImageSize, NotSupportedImage, FailedToProcess, Timeout, or InternalServerError.

POST {Endpoint}/vision/v3.2/areaOfInterest
POST {Endpoint}/vision/v3.2/areaOfInterest?model-version={model-version}

URI Parameters

Name In Required Type Description
Endpoint
path True

string

Supported Cognitive Services endpoints.

model-version
query

string

Optional parameter to specify the version of the AI model. Accepted values are: "latest", "2021-04-01", "2021-05-01". Defaults to "latest".

Regex pattern: ^(latest|\d{4}-\d{2}-\d{2})(-preview)?$

Request Header

Name Required Type Description
Ocp-Apim-Subscription-Key True

string

Request Body

Name Required Type Description
url True

string

Publicly reachable URL of an image.

Responses

Name Type Description
200 OK

AreaOfInterestResult

The response includes the extracted area of interest in JSON format.

Other Status Codes

ComputerVisionErrorResponse

Error response.

Security

Ocp-Apim-Subscription-Key

Type: apiKey
In: header

Examples

Successful GetAreaOfInterest request

Sample request

POST https://westus.api.cognitive.microsoft.com/vision/v3.2/areaOfInterest


{
  "url": "{url}"
}

Sample response

{
  "areaOfInterest": {
    "h": 951,
    "w": 950,
    "x": 160,
    "y": 0
  },
  "requestId": "ed2de1c6-fb55-4686-b0da-4da6e05d283f",
  "metadata": {
    "format": "Jpeg",
    "height": 951,
    "width": 1378
  },
  "modelVersion": "2021-04-01"
}

Definitions

Name Description
AreaOfInterestResult

Result of AreaOfInterest operation.

BoundingRect

A bounding box for an area inside an image.

ComputerVisionError

The API request error.

ComputerVisionErrorCodes

The error code.

ComputerVisionErrorResponse

The API error response.

ComputerVisionInnerError

Details about the API request error.

ComputerVisionInnerErrorCodeValue

The error code.

ImageMetadata

Image metadata.

ImageUrl

AreaOfInterestResult

Result of AreaOfInterest operation.

Name Type Description
areaOfInterest

BoundingRect

A bounding box for an area of interest inside an image.

metadata

ImageMetadata

Image metadata.

modelVersion

string

Version of the AI model.

requestId

string

Id of the REST API request.

BoundingRect

A bounding box for an area inside an image.

Name Type Description
h

integer

Height measured from the top-left point of the area, in pixels.

w

integer

Width measured from the top-left point of the area, in pixels.

x

integer

X-coordinate of the top left point of the area, in pixels.

y

integer

Y-coordinate of the top left point of the area, in pixels.

ComputerVisionError

The API request error.

Name Type Description
code

ComputerVisionErrorCodes

The error code.

innererror

ComputerVisionInnerError

Inner error contains more specific information.

message

string

A message explaining the error reported by the service.

ComputerVisionErrorCodes

The error code.

Name Type Description
InternalServerError

string

InvalidArgument

string

InvalidRequest

string

ServiceUnavailable

string

ComputerVisionErrorResponse

The API error response.

Name Type Description
error

ComputerVisionError

Error contents.

ComputerVisionInnerError

Details about the API request error.

Name Type Description
code

ComputerVisionInnerErrorCodeValue

The error code.

message

string

Error message.

ComputerVisionInnerErrorCodeValue

The error code.

Name Type Description
BadArgument

string

CancelledRequest

string

DetectFaceError

string

FailedToProcess

string

InternalServerError

string

InvalidDetails

string

InvalidImageFormat

string

InvalidImageSize

string

InvalidImageUrl

string

InvalidModel

string

InvalidThumbnailSize

string

NotSupportedFeature

string

NotSupportedImage

string

NotSupportedLanguage

string

NotSupportedVisualFeature

string

StorageException

string

Timeout

string

Unspecified

string

UnsupportedMediaType

string

ImageMetadata

Image metadata.

Name Type Description
format

string

Image format.

height

integer

Image height, in pixels.

width

integer

Image width, in pixels.

ImageUrl

Name Type Description
url

string

Publicly reachable URL of an image.