Skip to main content

AXIS Object analytics API

The VAPIX® AXIS Object analytics API (AOA API) contains the information that makes it possible configure a number of different scenarios with object detection. Each scenario or event defines a set of rules that can be applied to detected objects to decide if an alarm should be triggered. AOA can also filter out unwanted objects, such as small animals and moving leafs. All of this can be made visible on the video stream.

AOA supports fixed cameras, PTZ (Pan, Tilt, Zoom) cameras.

The Common Gateway Interface (CGI) API provides the ability to configure and setup different scenarios for object analytics.

Overview

The API implements control.cgi as its communications interface and supports the following methods:

MethodDescription
getConfigurationCapabilitiesRetrieve information about the configuration limits and capabilities of the camera where the application is running.
setConfigurationApply a complete application configuration to the camera.
getConfigurationRetrieve a complete application configuration.
getSupportedVersionsRetrieve a list of supported API versions.
sendAlarmTrigger a test alarm.
getAccumulatedCountsRetrieve current accumulated counts from a Crossline Counting scenario.
resetAccumulatedCountsReset the accumulated counts from a Crossline Counting scenario.
resetPassthroughReset the passthrough counter for a Crossline Counting scenario.
getOccupancyRetrieve the current occupancy for an Occupancy in Area scenario.

Additional information about the API method, their parameters and how to use them can be found here:

JSON syntax

The API implements the Google JSON style guide for its method structure.

Optional JSON parameters may be omitted or sent as null, [] or {}. Please note that the Object analytics application can’t modify or format the parameters in a successful setConfiguration request and the client format will instead be kept in a consecutive getConfiguration request.

Identification

Use /axis-cgi/applications/list.cgi to check if the application is installed on your Axis device.

Common examples

Read configuration capabilities

Use this example to retrieve the application capabilities of your device. This is useful when you want to adapt a user interface to implement either limitations or the default values of the application, including support for multiple camera models.

1. Request configuration capabilities.

http://<servername>/local/objectanalytics/control.cgi

JSON input parameters

{
"apiVersion": "1.2",
"context": "my context",
"method": "getConfigurationCapabilities"
}

2. Parse the JSON response.

{
"apiVersion": "1.2",
"context": "my context",
"method": "getConfigurationCapabilities",
"data": {
...
}
}

See getConfigurationCapabilities for additional details.

Create a scenario for object detection

Use this example to set up rules that should apply for the object detection on your device. A minimal scenario consists of an ID, name, trigger and a list of connected devices. For additional information see Scenarios.

1. Configure the basic scenario parameters. The code below contains the minimal requirements for a scenario and consists of the following parameters:

  • id: The identifier
  • name: The human readable name for the scenario.
  • type: Determines what trigger and filter types that should be allowed. For example, the motion scenario implements an include area for triggering alarms.
  • devices: Tells the application which device the scenario should be uploaded to.
  • triggers: Defines an include area that will trigger when detecting a moving object.
{
...

"scenarios": [
{
"id": 1,
"name": "My Scenario",
"type": "motion",
"devices": [
{
"id": 1
}
],
"triggers": [
{
"type": "includeArea",
"vertices": [[-0.9, -0.9], [-0.9, 0.9], [0.9, 0.9], [0.9, -0.9]]
}
]
}
],
...
}

2. Use the setConfiguration method to upload the configuration to your device. The scenario will take effect immediately.

http://<servername>/local/objectanalytics/control.cgi

JSON input parameters

{
"apiVersion": "1.2",
"context": "my context",
"method": "setConfiguration",
"params": {
<the complete configuration object defined above>
}
}

3. Parse the JSON response.

Successful response

{
"apiVersion": "1.2",
"context": "my context",
"method": "setConfiguration"
}

Error response

{
"apiVersion": "1.2",
"context": "my context",
"method": "setConfiguration",
"error": {
"code": 2004,
"message": "Invalid parameter"
}
}

4. Verify that objects detected in the include area triggers an alarm.

See Scenarios and setConfiguration for additional details.

Visualize scenario alarms

Use this example to control an overlay from the object detection scenarios, visible in both live and recorded video.

1. Enable metadata overlays in the device configuration. The first step is to make sure that there is an entry in the metadataOverlay device listing. This will tell the application what resolutions that should be used for each specific device. The following example will assume that the camera has one optical device that put out a metadata overlay in 1280x720.

"metadataOverlay": [
{
"id": 1,
"drawnOnAllResolutions": false,
"resolutions": [
"1280x720"
]
}
]

See Metadata overlay for additional information.

2. Enable overlays in the scenario configuration, such as the one created in step 1. This will initiate the overlay, while omitting it will halt the scenario.

"scenarios": [
...

{
...
"name": "my scenario",
"metadataOverlay": 1,
...
},

...
]

See Scenarios for additional information.

3. Use the setConfiguration method to upload your new configuration. This will start the metadata overlay in the configured resolutions.

http://<servername>/local/objectanalytics/control.cgi

JSON input parameters

{
"apiVersion": "1.2",
"context": "my context",
"method": "setConfiguration",
"params": {
...
}
}

4. Parse the JSON response.

Successful response

{
"apiVersion": "1.2",
"context": "my context",
"method": "setConfiguration"
}

Error response

{
"apiVersion": "1.2",
"context": "my context",
"method": "setConfiguration",
"error": {
"code": 2004,
"message": "Invalid parameter"
}
}

5. Verify that the detected objects are visible in the video stream.

See setConfiguration for additional details.

Backup and restore configuration

Use this example to create a back-up configuration on your cameras that can then be restored at a later time.

Retrieve the current configuration from the application

1. Request the current configuration using the getConfiguration method.

http://<servername>/local/objectanalytics/control.cgi

JSON input parameters

{
"apiVersion": "1.2",
"context": "my context",
"method": "getConfiguration"
}

2. Parse the JSON response. The data object contains the entire configuration.

{
"apiVersion": "1.2",
"context": "my context",
"method": "getConfiguration",
"data": {
...
}
}

3. Store the configuration data for backup purposes.

See getConfiguration for additional details.

Upload a backup configuration to the application

1. Upload the stored configuration using the setConfiguration method. The params object should be the contents of the data object from the previous request.

http://<servername>/local/objectanalytics/control.cgi

JSON input parameters

{
"apiVersion": "1.2",
"context": "my context",
"method": "setConfiguration",
"params": {
<the backed up <data> object from getConfiguration>
}
}

2. Parse the JSON response.

Successful response

{
"apiVersion": "1.2",
"context": "my context",
"method": "setConfiguration"
}

Error response

{
"apiVersion": "1.2",
"context": "my context",
"method": "setConfiguration",
"error": {
"code": 2004,
"message": "Invalid parameter"
}
}

See setConfiguration for additional details.

API specification

getConfigurationCapabilities

This method is used when you want to request a JSON object that describes the min, max and default/reference values of all configurable parameters.

Request

  • Security level: Admin
  • Method: POST
http://<servername>/local/objectanalytics/control.cgi
{
"apiVersion": "<Major>.<Minor>",
"context": <string>,
"method": "getConfigurationCapabilities"
}
ParameterDescription
apiVersionThe API version that should be used.
context=<string>A text string echoed back in the corresponding response (optional).
method="getConfigurationCapabilities"Specifies the API method.

Return value - Success

  • HTTP Code: 200 OK
  • Content-Type: application/json

Response body syntax

{
"apiVersion": "<Major>.<Minor>",
"context": <string>,
"method": "getConfigurationCapabilities",
"data": {
"devices": [
...
],
"filters": [
...
],
"metadataOverlay": {
...
},
"objectClassifications": {
...
},
"perspective": {
...
},
"scenarios": {
...
},
"triggers": [
...
],
"presets": {
...
}
}
}
ParameterDescription
apiVersionThe API version used in the request.
contextThe context string provided in the request.
method="getConfigurationCapabilities"The API method used in the request.
dataThe data object.
devicesContainer for the supported video devices.
filtersContainer for the supported filters.
metadataOverlayContainer for the metadata overlay options.
objectClassificationsContainer for the classification types as well as their subtypes.
perspectiveContainer for the perspective data.
scenariosContainer for the scenario data.
triggersContainer for the supported trigger types.
presetsContainer for the PTZ presets.

For additional information about the data field, it’s supported parameters and respective value, see Configuration capabilities.

Return value - Error

  • HTTP Code: 200 OK
  • Content-Type: application/json

Response body syntax

{
"apiVersion": "<Major>.<Minor>",
"context": "<string>",
"method": "getConfigurationCapabilities",
"error": {
"code": <integer error code>,
"message": <string>
}
}

Error codes

Error codeDescription
1000An error occurred inside the application.
2000The requested version of the application is not supported.
2003A mandatory parameter is missing.
2005The requested CGI method is not supported.

getConfiguration

This method is used when you want to request a JSON object describing the current application configuration.

Request

  • Security level: Operator
  • Method: POST
http://<servername>/local/objectanalytics/control.cgi
{
"apiVersion": "<Major>.<Minor>",
"context": "<string>",
"method": "getConfiguration"
}
ParameterDescription
apiVersionThe API version that should be used.
context=<string>A text string echoed back in the corresponding response (optional).
method="getConfiguration"Specifies the API method.

Return value - Success

  • HTTP Code: 200 OK
  • Content-Type: application/json

Response body syntax

{
"apiVersion": "<Major>.<Minor>",
"context": "<string>",
"method": "getConfiguration",
"data": {
"devices": [
...
],
"filters": [
...
],
"metadataOverlay": {
...
},
"objectClassifications": {
...
},
"perspective": {
...
},
"scenarios": {
...
},
"triggers": [
...
],
"presets": {
...
}
}
}
ParameterDescription
apiVersionThe API version used in the request.
contextThe context string provided in the request.
method="getConfiguration"The API method used in the request.
dataThe data object.
devicesContainer for the supported video devices.
filtersContainer for the supported filters.
metadataOverlayContainer for the metadata overlay options.
objectClassificationsContainer for the classification types as well as their subtypes.
perspectiveContainer for the perspective data.
scenariosContainer for the scenario data.
triggersContainer for the supported trigger types.
presetsContainer for the PTZ presets.

For additional information about the data field, it’s supported parameters and respective value, see Configuration capabilities.

Return value - Error

  • HTTP Code: 200 OK
  • Content-Type: application/json

Response body syntax

{
"apiVersion": "<Major>.<Minor>",
"context": "<string>",
"method": "getConfiguration",
"error": {
"code": <integer error code>,
"message": <string>
}
}

Error codes

Error codeDescription
1000An error occurred inside the application.
2000The requested version of the application is not supported.
2003A mandatory parameter is missing.
2005The requested CGI method is not supported.

setConfiguration

This method is used when you want to set a configuration of the application immediately. Any ongoing event will be set as inactive when a new configuration is applied, which will cause ongoing recordings to stop. This is also true for multichannel cameras, which will all be affected simultaneously. Exception is made if there is movement in the include area even after the configuration has been set and no exclusion filter hinders the alarm to be sent. This will instead cause the event to be set to active directly after the new configuration is applied.

Request

  • Security level: Operator
  • Method: POST
http://<servername>/local/objectanalytics/control.cgi
{
"apiVersion": "<Major>.<Minor>",
"context": <string>,
"method": "setConfiguration"
"params": {
...
}
}
ParameterDescription
apiVersionThe API version that should be used.
context=<string>A text string echoed back in the corresponding response (optional).
method="setConfiguration"Specifies the API method.
paramsThe parameter objects.

Return value - Success

  • HTTP Code: 200 OK
  • Content-Type: application/json

Response body syntax

{
"apiVersion": "<Major>.<Minor>",
"context": <string>,
"method": "setConfiguration",
"data": {}
}
ParameterDescription
apiVersionThe API version used in the request.
contextThe context string provided in the request.
method="setConfiguration"The API method used in the request.
dataThe data object.

Return value - Error

  • HTTP Code: 200 OK
  • Content-Type: application/json

Response body syntax

{
"apiVersion": "<Major>.<Minor>",
"context": "<string>",
"method": "setConfiguration",
"error": {
"code": <integer error code>,
"message": <string>
}
}

Error codes

Error codeDescription
1000An error occurred inside the application.
2000The requested version of the application is not supported.
2002Incoherent configuration (such as mismatched ID).
2003A mandatory parameter is missing.
2004Invalid parameter.
2005The requested CGI method is not supported.

getSupportedVersions

This method is used when you want to retrieve a list of API versions supported by your device.

Request

  • Security level: Operator
  • Method: POST
http://<servername>/local/objectanalytics/control.cgi
{
"context": <string>,
"method": "getSupportedVersions"
}
ParameterDescription
context=<string>A text string echoed back in the corresponding response (optional).
method="getSupportedVersions"Specifies the API method.

Return value - Success

  • HTTP Code: 200 OK
  • Content-Type: application/json

Response body syntax

{
"apiVersion": "<Major>.<Minor>",
"context": <string>,
"method": "getSupportedVersions",
"data": {
"apiVersions": [<Major>.<Minor>, ...]
}
}
ParameterDescription
apiVersionThe API version used in the request.
contextThe context string provided in the request.
method="getSupportedVersions"The API method used in the request.
dataThe data object.
apiVersionsA list of API versions supported by the application.

Return value - Error

  • HTTP Code: 200 OK
  • Content-Type: application/json

Response body syntax

{
"apiVersion": "<Major>.<Minor>",
"context": "<string>",
"method": "getSupportedVersions",
"error": {
"code": <integer error code>,
"message": <string>
}
}

Error codes

Error codeDescription
1000An error occurred inside the application.
2005The requested CGI method is not supported.

sendAlarmEvent

This method is used when you want to force a scenario to enter its alarm state for a 3 second duration. This will trigger the scenario to emit events in both AXIS and ONVIF formats while the alarm is on high.

Request

  • Security level: Operator
  • Method: POST
http://<servername>/local/objectanalytics/control.cgi
{
"apiVersion": "<Major>.<Minor>",
"context": <string>,
"method": "sendAlarmEvent"
"params": {
"scenario": <uid>
}
}
ParameterDescription
apiVersionThe API version that should be used.
context=<string>A text string echoed back in the corresponding response (optional).
method="sendAlarmEvent"Specifies the API method.
scenario=<uid>Defines which scenario that will send the alarm event. <uid> represents the unique scenario ID.

Return value - Success

  • HTTP Code: 200 OK
  • Content-Type: application/json

Response body syntax

{
"apiVersion": "<Major>.<Minor>",
"context": <string>,
"method": "sendAlarmEvent",
"data": {}
}
ParameterDescription
apiVersionThe API version used in the request.
contextThe context string provided in the request.
method="sendAlarmEvent"The API method used in the request.
dataThe data object.

Return value - Error

  • HTTP Code: 200 OK
  • Content-Type: application/json

Response body syntax

{
"apiVersion": "<Major>.<Minor>",
"context": "<string>",
"method": "sendAlarmEvent",
"error": {
"code": <integer error code>,
"message": <string>
}
}

Error codes

Error codeDescription
1000An error occurred inside the application.
2000The requested version of the application is not supported.
2005The requested CGI method is not supported.

getAccumulatedCounts

This method is used when you want to retrieve the accumulated counts for a Crossline Counting scenario. The response will include the total number of objects for each configured class that have passed the counting line.

Request

  • Security level: Operator
  • Method: POST
http://<servername>/local/objectanalytics/control.cgi
{
"apiVersion": "<Major>.<Minor>",
"context": "<string>",
"method": "getAccumulatedCounts",
"params": {
"scenario": <uid>
}
}
ParameterDescription
apiVersionThe API version that should be used.
context=<string>A text string echoed back in the corresponding response (optional).
method="getAccumulatedCounts"Specifies the API method.
scenario=<uid>Defines the scenario from which the accumulated counts should be obtained. <uid> represents the unique scenario ID.

Return value - Success

  • HTTP Code: 200 OK
  • Content-Type: application/json

Response body syntax

{
"apiVersion": "<Major>.<Minor>",
"context": "<string>",
"method": "getAccumulatedCounts",
"data": {
"resetTime": "<time when counting started or was last reset>",
"timeStamp": "<time when count was read>",
"total": "<number of counted objects of any category>",
"<category>": "<number of counted objects of a specific category>"
}
}
ParameterDescription
apiVersionThe API version used in the request.
contextThe context string provided in the request.
method="getAccumulatedCounts"The API method used in the request.
dataThe data object.
resettimeTime when counting started or was last reset in the ISO 8601 format (a string YYYY-MM-DDTHH:MM:SSZ where Y, M, D, H, M and S are numbers expressing year, month, day, hour [00-23], minutes and seconds.)
timestampTime when count was read in the ISO 8601 format (a string YYYY-MM-DDTHH:MM:SSZ, where Y, M, D, H, M and S are numbers expressing year, month, day, hour [00-23], minutes and seconds).
totalThe total number of counted objects of any category.
<category>The number of counted objects of a specific <category> which, depending on the configuration, can be car, bus, bike, human, truck or otherVehicle. Each category included in the configuration corresponds to one entry in the data collection in the return value.

Return value - Error

  • HTTP Code: 200 OK
  • Content-Type: application/json

Response body syntax

{
"apiVersion": "<Major>.<Minor>",
"context": "<string>",
"method": "getAccumulatedCounts",
"error": {
"code": <integer error code>,
"message": <string>
}
}

Error codes

Error codeDescription
2000The requested version of the application is not supported.
2003A mandatory parameter is missing.
2004The configuration contain an invalid parameter.

resetAccumulatedCounts

This method is used when you want to reset the object counts for a Crossline Counting scenario.

Request

  • Security level: Operator
  • Method: POST
http://<servername>/local/objectanalytics/control.cgi
{
"apiVersion": "<Major>.<Minor>",
"context": "<string>",
"method": "resetAccumulatedCounts",
"params": {
"scenario": <uid>
}
}
ParameterDescription
apiVersionThe API version that should be used.
context=<string>A text string echoed back in the corresponding response (optional).
method="resetAccumulatedCounts"Specifies the API method.
scenario=<uid>Defines the scenario from which the accumulated counts should be obtained. <uid> represents the unique scenario ID.

Return value - Success

  • HTTP Code: 200 OK
  • Content-Type: application/json

Response body syntax

{
"apiVersion": "<Major>.<Minor>",
"context": "<string>",
"method": "resetAccumulatedCounts",
"data": {}
}
ParameterDescription
apiVersionThe API version used in the request.
contextThe context string provided in the request.
method="resetAccumulatedCounts"The API method used in the request.
dataThe data object.

Return value - Error

  • HTTP Code: 200 OK
  • Content-Type: application/json

Response body syntax

{
"apiVersion": "<Major>.<Minor>",
"context": "<string>",
"method": "resetAccumulatedCounts",
"error": {
"code": <integer error code>,
"message": <string>
}
}

Error codes

Error codeDescription
2000The requested version of the application is not supported.
2003A mandatory parameter is missing.

resetPassthrough

This method is used when you want to reset the counter used for passthrough for a Crossline Counting scenario. The passthrough threshold is represented by the N integer and will, when active, generate a new event for every N count by a separate passthrough counter.

Request

  • Security level: Operator
  • Method: POST
http://<servername>/local/objectanalytics/control.cgi
{
"apiVersion": "<Major>.<Minor>",
"context": "<string>",
"method": "resetPassthrough",
"params": {
"scenario": <uid>
}
}
ParameterDescription
apiVersionThe API version that should be used.
context=<string>A text string echoed back in the corresponding response (optional).
method="resetPassthrough"Specifies the API method.
scenario=<uid>Defines the scenario from which the accumulated counts should be obtained. <uid> represents the unique scenario ID.

Return value - Success

  • HTTP Code: 200 OK
  • Content-Type: application/json

Response body syntax

{
"apiVersion": "<Major>.<Minor>",
"context": "<string>",
"method": "resetPassthrough",
"data": {}
}
ParameterDescription
apiVersionThe API version used in the request.
contextThe context string provided in the request.
method="resetPassthrough"The API method used in the request.
dataThe data object.

Return value - Error

  • HTTP Code: 200 OK
  • Content-Type: application/json

Response body syntax

{
"apiVersion": "<Major>.<Minor>",
"context": "<string>",
"method": "resetPassthrough",
"error": {
"code": <integer error code>,
"message": <string>
}
}

Error codes

Error codeDescription
2000The requested version of the application is not supported.
2003A mandatory parameter is missing.

getOccupancy

This method is used when you want to retrieve the current object counts for an Occupancy in Area scenario.

Request

  • Security level: Operator
  • Method: POST
http://<servername>/local/objectanalytics/control.cgi
{
"apiVersion": "<Major>.<Minor>",
"context": "<string>",
"method": "getOccupancy",
"params": {
"scenario": <uid>
}
}
ParameterDescription
apiVersionThe API version that should be used.
context=<string>A text string echoed back in the corresponding response (optional).
method="getOccupancy"Specifies the API method.
scenario=<uid>Defines the scenario from which the accumulated counts should be obtained. <uid> represents the unique scenario ID.

Return value - Success

  • HTTP Code: 200 OK
  • Content-Type: application/json

Response body syntax

{
"apiVersion": "<Major>.<Minor>",
"context": "<string>",
"method": "getOccupancy",
"data": {
"timeStamp": "<time when count was read>",
"total": "<number of counted objects of any category>",
"<category>": "<number of counted objects of a specific category>"
}
}
ParameterDescription
apiVersionThe API version used in the request.
contextThe context string provided in the request.
method="getOccupancy"The API method used in the request.
dataThe data object.
timestampTime when count was read in the ISO 8601 format (a string YYYY-MM-DDTHH:MM:SSZ, where Y, M, D, H, M and S are numbers expressing year, month, day, hour [00-23], minutes and seconds).
totalThe total number of counted objects of any category.
<category>The number of counted objects of a specific <category> which, depending on the configuration, can be car, bus, bike, human, truck or otherVehicle. Each category included in the configuration corresponds to one entry in the data collection in the return value.

Return value - Error

  • HTTP Code: 200 OK
  • Content-Type: application/json

Response body syntax

{
"apiVersion": "<Major>.<Minor>",
"context": "<string>",
"method": "getOccupancy",
"error": {
"code": <integer error code>,
"message": <string>
}
}

Error codes

Error codeDescription
2000The requested version of the application is not supported.
2003A mandatory parameter is missing.
2004The configuration contains an invalid parameter.

Configuration

The purpose of this section is to describe the contents of the setConfiguration parameter objects and getConfiguration data objects. All listed coordinates are in the ONVIF format unless otherwise specified.

Overview

The field in the general configuration structure seen below are all described in their separate sections. You will find that the structure is the same for both single and multichannel products, where the devices array lists the available channels in the camera.

All parameters and properties are considered mandatory unless otherwise specified.

"data": {
"devices": [
...
],
"metadataOverlay": [
...
],
"perspectives": [
...
],
"scenarios": [
...
]
}

Devices

To use a device in a scenario it first needs to be configured. This can be done by providing an entry for the device in the devices array. Throughout this chapter, the term device refers to a physical or virtual device within the camera, capable of providing input to object analytics. Currently, only video streams originating from a physical hardware channel are supported.

"devices": [
{
"id": <int>,
"type": <string>,
"rotation": <degrees>,
"isActive": <boolean>
},
...
]
ParameterDescription
idThe device id that should correspond to the id in data.devices in getConfigurationCapabilities.
typeThe device type (can only be camera).
rotationThe camera rotation, measured in degrees. Valid values are 0, 90, 180 or 270.
isActive OptionalTrue if omitted. Excludes the device from being used if set to false. Any scenarios, perspectives or metadata overlays referring to this device will also be ignored.

Metadata overlay

An array of metadata overlay configurations. The size of this array is limited by getConfigurationCapabilities.data.metadataOverlay.minNbrActiveCameras and getConfigurationCapabilities.data.metadataOverlay.maxNbrActiveCameras.

Each device that puts out metadata overlays in a video stream requires a corresponding overlay configuration. In this case, the metadataOverlay.id field should match the array ID under data.metadataOverlay.cameras field of a device in the data.devices array. See Devices for additional information.

To enable metadata overlays in a scenario, you first need to specify which metadata configuration to use. This can be done by using the metadataOverlay parameter in the scenario. See Scenarios for additional information.

"metadataOverlay": [
{
"id": <int>,
"drawOnAllResolutions": <boolean>
"resolutions": ["<width>x<height>", "<width>x<height>", ...]
},
...
]
ParameterDescription
idThe metadata overlay ID in the range [1 ... n]. Corresponds to the device ID.
drawOnAllResolutionsA boolean that determines whether the metadata overlay should be drawn on all available resolutions. This parameter is not mandatory if resolutions is specified.
resolutionsThe supported resolutions array in the format <width>x<height>. This parameter should be empty nor not specified if drawOnAllResolutions is true.

Perspectives

By adding an entry to the perspectives list, you are able to define and use perspective filters in a scenario.

A perspective is composed of a number of bars and an algorithm that approximates the perspective of the entire image using the bars as a guide.

  • The number of perspectives are limited by getConfigurationCapabilities.
  • A perspective can only be applied to one device, meaning separate perspective configuration must be used in setups that include multiple devices.
"perspectives": [
{
"id": <int>,
"bars": [
"height": <int>,
"points": [
[<x1>, <y1>],
[<x2>, <y2>]
],
...
]
},
...
]
ParameterDescription
idA unique ID identifying the perspective.
barsA list of bars contributing to the perspective calculation, limited by getConfigurationCapabilities.
bars.heightThe virtual height (in centimeters) of an object appearing at the same location and perceived height in the camera view as the perspective bar.
bars.pointsStart pos 0 and end pos 1 points for a perspective bar in ONVIF coordinates. The start position should be the point that touches the ground-plane.

Scenarios

The majority of the AOA application configurations are done within a scenario, including filters, triggers, object classifications and PTZ presets.

  • Scenarios act as user modes that create distinction between different triggers.
  • Scenarios lets you create individual setups that can run in parallel.
  • The number of simultaneously allowed scenarios are defined in getConfigurationCapabilities.
"scenarios": [
{
"id": <int>,
"name": <string>,
"type": <string>,
"metadataOverlay": <id>,
"alarmRate": <string>,
"devices": [
...
],
"triggers": [
...
],
"filters": [
...
],
"objectClassifications": [
...
],
"perspectives": [
...
],
"presets": [
...
],
}
]
ParameterDescription
idA unique scenario ID.
nameA user friendly scenario name.
typeSee table below for possible scenario types.
metadataOverlay OptionalEnables and disables metadata overlays for a scenario, however it must point to a valid id in the metadataOverlay array.
alarmRate OptionalSets the alarm rate for the scenario. Valid rates are listed in getConfigurationCapabilities.data.scenarios.alarmRates.
devicesMandatory, see Scenario devices.
triggersMandatory, see Scenario triggers.
filters OptionalSee Scenario filters.
objectClassifications OptionalSee Scenario object classifications.
perspectives OptionalSee Scenario perspectives.
presets OptionalSee Scenario PTZ presets.

In terms of API functionality, different scenarios will either enable or disable some configurable settings such as triggers, shown in the table Scenario feature matrix below.

Scenario types

TypeDescription
motionThis scenario makes it possible to define an include area which acts as a trigger zone for moving objects. Additionally, filters can be configured to exclude objects based on other criteria, such as size.
fenceThis scenario makes it possible to define a special fence trigger with a polyline shape activated by objects passing the line in a certain direction. See Scenario triggers for additional information.
crosslinecountingCrossline Counting scenario count objects crossing a defined counting line. The line has a polyline shape and is triggered by objects passing the line in a specified direction. See Scenario triggers for additional information.
occupancyInAreaOccupancy in Area scenario allows defining an include area which are able to count objects. This include stationary objects.

The triggers and filters supported by a scenario varies with scenario type, which means that you will receive an error message if a configuration with unsupported triggers or filters are uploaded.

Scenario feature matrix

FeaturemotionfencecrosslinecountingoccupancyinAreaoccupancyinArea
FiltersExclude AreaYesNoNoYes
Size PercentageYesYesNoNo
Size PerspectiveYesYesYesYes
Short-lived objectsYesYesNoNo
Swaying objectsYesNoNoNo
SpeedYesYesNoNo
TriggersInclude AreaYesNoNoYes
FenceNoYesNoNo
Counting LineNoNoYesNo

Scenario devices

Lists the devices that the scenario should be applied to.

"devices": [
{
"id": <int>
}
...
]
ParameterDescription
idPoints towards the device ID defined in the root devices list. See Devices for additional information.

Scenario triggers

The triggers are what makes the application raise an alarm in a given scenario.

  • At least one trigger needs to be defined in a scenario for it to be valid.
  • The type of triggers available to a scenario depends on the scenario type.
"triggers": [
{
"type": <string>,
...
},
...
]

Include area

This trigger is a polygon that activates an alarm whenever an object intersects an area defined by the polygon.

{
"type": "includeArea",
"vertices": [
[<x1>, <y1>],
[<x2>, <y2>]
...
]
}
ParameterDescription
verticesA list of vertices that forms the include area.

Fence

This trigger is a polyline that activates an alarm when an object crosses a line.

{
"type": "fence",
"alarmDirection": <string>,
"vertices": [
[<x1>, <y1>],
[<x2>, <y2>]
...
]
}
ParameterDescription
alarmDirectionThe direction in which the trigger will activate the alarm for a crossing object, defined by getConfigurationCapabilities.
alarmDirectionDescription
"leftToRight"The fence trigger raises a alarm when an object passes the start of the reference line beginning at the left and going to the right side.
"rightToLeft"The fence trigger raises a alarm when an object passes the start of the reference line beginning at the right and going to the left side.

Counting line

A counting line trigger is a polyline that counts when an object crosses this line.

{
"type": "countingLine",
"countingDirection": <string>,
"vertices": [
[<x1>, <y1>],
[<x2>, <y2>]
...
]
}
ParameterDescription
CountingDirectionThe direction in which the trigger will count a crossing object, defined by getConfigurationCapabilities.
countingDirectionDescription
"leftToRight"Triggers when an object passes the reference line from the left side of the line to the right side.
"rightToLeft"Triggers when an object passes the reference line from the right side of the line to the left side.

Scenario filters

The filters makes it possible to set up optional rules that excludes objects from detection and raising the alarm.

"filters": [
{
"type": <string>,
...
},
...
]
ParameterDescription
typeSee sections below.

Size percentage

This high-pass filter excludes small objects based on their size in the view port. The size is defined as a fraction of the width and height of the total view area, measured in percent. Any object smaller than that will be filtered out and not raise an alarm.

  • Only one size filter is allowed, i.e. sizePerspective and sizePercentage can’t be enabled simultaneously.
{
"type": "sizePercentage",
"width": <int>,
"height": <int>
}
ParameterDescription
widthThe horizontal upper limit of the filter size (in ONVIF coordinates).
heightThe vertical upper limit of the filter size (in ONVIF coordinates).

Size perspective

This high-pass filter excludes small objects based on their real-world size. The dimensions of these objects are defined in a virtual coordinate system calculated by using the perspective. For example, if the object’s calculated width and height is below this value, no alarm will be raised. The real-world height of the object if computed by applying the scenario perspective.

  • Only one size filter is allowed, i.e. sizePerspective and sizePercentage can’t be enabled simultaneously.
  • To configure a perspective filter, the scenario must point to a valid perspective. See Scenario perspectives for additional information.
{
"type": "sizePerspective",
"width": <int>,
"height": <int>
}
ParameterDescription
widthThe horizontal upper limit of the filter size (in centimeters).
heightThe vertical upper limit of the filter size (in centimeters).

Short-lived objects

An object must be seen for a number of seconds before an alarm can be triggered, meaning if an object has been in the image longer than the filter time and then moves into the include area the scenario will immediately trigger the alarm. This allows brief objects and noise to be filtered out.

{
"type": "timeShortLivedLimit",
"time": <sec>
}
ParameterDescription
timeThe waiting time, measured in seconds, until a detected object rase an alarm.

Swaying objects

This filter sets the distance by which an object can move before raising an alarm. This setting is measured in percent of the image width and height. If configured correctly, swaying objects like leafs and trees can be filtered out.

{
"type": "distanceSwayingObject",
"distance": <int>
}
ParameterDescription
distanceThe distance a detected object is allowed to travel before raising an alarm, measured in percent of the image.

Speed

Speed filters are used to define speed ranges, in meters per seconds, for objects where the alarms are not triggered. Several speed filter instances can be created.

These filters can only be used when the scenario is configured with a secondary radar device.

{
"type": "speed",
"minSpeed": <float>,
"maxSpeed": <float>
}
ParameterDescription
minSpeed/maxSpeedThe ground speed between minSpeed/maxSpeed where the moving object won’t raise an alarm.

Exclude area

This filter makes it possible to define areas of the image where alarms can’t be triggered. In contrast to other filters, it can create several exclude areas.

{
"type": "excludeArea",
"vertices": [
[<x1>, <y1>],
[<x2>, <y2>]
...
]
}
ParameterDescription
verticesA list of vertices forming the exclude area polygon.

Scenario perspectives

Lists the perspectives used by the scenario. Please note that this list does not define any perspectives in itself, but instead refers to the list of perspectives found in data.perspectives.

  • This scenario option is optional, but becomes mandatory if a perspective filter has been configured.
"perspectives": [
<id>,
...
]
ParameterDescription
perspectivesA list of perspective IDs used in the scenario.

Scenario object classifications

Configures the kind of objects that should raise an alarm. The objectClassifications structure is recursive since subTypes points to a new type/subType pair, allowing a tree structure to describe objects. A two-level depth is currently supported.

  • The subType parameter is only used if the camera supports classification subtypes. See getConfigurationCapabilities for additional information.
  • The graphical SVG representation will draw the configured classes for detected objects.
note

An empty objectClassifications array implies that an alarm can be triggered on any detected motion. Filters can still be used to limit unwanted detections.

"objectClassifications": [
{
"type": <string>,
"subTypes": [
{
"type": <string>,
"subTypes": ...
}
...
]
},
...
]
ParameterDescription
typeIdentifies the object type.
subTypesA list of sub classifiers for a type (optional).

Object classifications example

The following example illustrates the recursive use of the subTypes parameters.

{
"type": "vehicle",
"subTypes": [
{
"type": "bus"
},
{
"type": "car",
"subTypes": [
{
"type": "sedan"
},
{
"type": "van"
}
]
}
]
}

Scenario PTZ presets

It is possible to configure the scenarios on PTZ devices to track specific preset positions.

  • The following presets are optional. If no presets are defined and you are using a PTZ device, it will continue tracking objects as long as the camera itself isn’t moving.
  • These presets are not valid on a non-PTZ device.
"presets": [
<id>,
...
]
ParameterDescription
presetsA list of PTZ preset positions that the scenario is tracking. See table below for valid values.
PresetDescription
-2Tracking is always enabled, except when camera is moving.
-1Tracking is done on all preset positions. No tracking is done if the PTZ device is not set to a preset.
1Tracking on the home position of the PTZ device.
2...Tracking on specific presets only.

Crossline Counting specific configurations

Crossline Counting scenarios allow additional configurations to reset accumulated counts at midnight, or trigger an event at every N count.

{
"accumulatedCounts": {
...
},
"passthroughConfiguration": {
...
}
}

Accumulated Counts

{
"timedResetEnabled": <boolean>
}
ParameterDescription
timedResetEnabledUsed if the timed reset for accumulated counts is enabled.

Passthrough Configuration

{
"enabled": <boolean>,
"period": <int>
}
ParameterDescription
enabledIndicates if the passthrough event is enabled.
periodTrigger an event for every <period> count.

Occupancy In Area specific configurations

Occupancy In Area scenarios allow additional configurations to trigger an alarm when a specified number of objects are in the area for a specific amount of time.

{
"thresholdConfiguration": {
"enabled": <boolean>,
"triggerDelay": <int>,
"thresholds": [
{
"level": <int>,
"type": <string>
}
]
}
}
ParameterDescription
enabledIndicates if the threshold events are enabled.
triggerDelayThe number of seconds to wait after the configured threshold has been reached before the alarm is triggered.
thresholdsA list o thresholds that need to be reached before the alarm can be triggered.
levelThe number of threshold objects.
typeCan be either moreThan or lessThan and triggers if the number of objects in the area are either more or less than the configured level.

Configuration capabilities

The parameter values in a configuration is limited by the capabilities of the camera on which the Object analytics application is running. These capabilities are read using the getConfigurationCapabilities method. This means that a configuration sent by the setConfiguration will be validated by the application and any values outside the capabilities of the camera will result in an error.

All coordinates are in the ONVIF format if not otherwise specified.

Overview

"data": {
"devices": [
...
],
"filters": [
...
],
"metadataOverlay": {
...
},
"objectClassifications": {
...
},
"perspective": {
...
},
"scenarios": {
...
},
"triggers": [
...
],
"presets": {
...
}
}

The content of these fields is described in their own separate chapters:

Devices

A list of supported video devices in the camera on which the application is running.

"devices": [
{
"id": <int>,
"type": <string>,
"imageIndex": <int>,
"name": <string>,
"rotation": <degree>,
"resolutions": [
"<int>x<int>",
...
],
"tags": [
<string>,
...
]
},
...
]
ParameterDescriptions
idThe device ID.
typeA string describing the device type.
imageIndexThe image source index.
nameThe device name.
rotationThe device rotation in the camera plane, measured in degrees. Valid values are 0, 90, 180 or 270.
resolutionsA list of supported camera resolutions in the format "<width>x<height>".
tagsA list of tags that indicates certain properties of the device.

Device tags

TagDescription
primaryThe primary device that should be used when a secondary device exists.
secondaryA secondary device that can only be used together with a primary device.
fisheyeA device equipped with a fisheye lens.

Filters

An array containing supported filters. The contents of a filter object depends on the type parameter.

"filters": [
{
"type": <string>,
...
},
...
]

Size percentage

{
"type": "sizePercentage",
"minWidth": <int>,
"maxWidth": <int>,
"minHeight": <int>,
"maxHeight": <int>,
"defaultWidth": <int>,
"defaultHeight": <int>
}
ParameterDescription
minWidth/maxWidthThe min/max allowed width as a percentage of the image.
minHeight/maxHeightThe min/max allowed height as a percentage of the image.
defaultWidthThe default width as a percentage of the image.
defaultHeightThe default height as a percentage of the image.

Size perspective

{
"type": "sizePerspective",
"minWidth": <int>,
"maxWidth": <int>,
"minHeight": <int>,
"maxHeight": <int>,
"defaultWidth": <int>,
"defaultHeight": <int>
}
ParameterDescription
minWidth/maxWidthThe min/max allowed virtual width, measured in centimeters.
minHeight/maxHeightThe min/max allowed virtual height, measured in centimeters.
defaultWidthThe default virtual width, measured in centimeters.
defaultHeightThe default virtual height, measured in centimeters.

Short-lived objects

{
"type": "timeShortLivedLimit",
"minDistance": <int>,
"maxDistance": <int>,
"defaultDistance": <int>
}
ParameterDescription
minTime/maxTimeThe min/max allowed time limit, measured in seconds.
defaultTimeThe default time limit, measured in seconds.

Swaying objects

{
"type": "distanceSwayingObject",
"minDistance": <int>,
"maxDistance": <int>,
"defaultDistance": <int>
}
ParameterDescription
minDistance/maxDistanceThe min/max allowed value for the swaying distance as a percentage of the image.
defaultDistanceThe default value for the swaying distance as a percentage of time image.

Speed

{
"type": "speed",
"minSpeed": <float>,
"maxSpeed": <float>,
"defaultMinSpeed": <float>,
"defaultMaxSpeed": <float>
}
ParameterDescription
minSpeed/maxSpeedThe min/max allowed values for the speed filter, in m/s.
defaultMinSpeed/defaultMaxSpeedThe default ground speed filter range in m/s.

Exclude area

{
"type": "excludeArea",
"minPosX": <real>,
"maxPosX": <real>,
"minPosY": <real>,
"maxPosY": <real>,
"minNbrVertices": <int>,
"maxNbrVertices": <int>,
"minNbrInstances": <int>,
"maxNbrInstances": <int>,
"defaultInstance": [
[<real>, <real>],
[<real>, <real>],
[<real>, <real>],
[<real>, <real>]
]
}
ParameterDescription
minPosX, maxPosX, minPosY, maxPosYAny exclude area vertices must be located within the rectangle formed by these coordinates.
minNbrVertices, maxNbrVerticesThe min/max number of vertices allowed in an exclude area polygon.
minNbrAreas, maxNbrAreasThe min/max number of exclude areas allowed by the filter.
defaultInstanceA reference exclude area in the shape of a rectangle.

Metadata overlay

"metadataOverlay": {
"minNbrActiveCameras": <int>,
"maxNbrActiveCameras": <int>,
"cameras": [
{
"id": <int>,
"canDrawInSpecifiedResolutions": <boolean>,
"resolutions": ["<int>x<int>", "<int>x<int>", ...]
},
...
]
}
ParameterDescription
minNbrActiveCamerasThe minimum number of cameras in a multichannel device that can be referenced in a metadata overlay. Please note that if the number of referenced cameras is 0, the overlay will be disabled.
maxNbrActiveCamerasThe maximum number of cameras in a multichannel device that can use the feature. Please note that if the value is 0, the feature is not supported.
camerasA list of camera objects describing the alarm overlay capabilities for each camera.
idSame as the cameras[i].id parameter in the configuration. The corresponding camera value used when requesting a video using media.amp, starting at 1.
canDrawInSpecifiedResolutionsDetermines if the camera has the capability to draw an alarm overly on a specified resolution. False means that the camera only supports drawing on all resolutions at once.
resolutionsA list of resolutions of the form <width>x<height> for which it is possible to use alarm overlay on a specific camera.

Object classification

This tree contains the supported classification types and their subtypes. The structure of this parameter matches the one in the configuration object. See Scenario object classifications for additional information.

"objectClassifications": [
{
"type": <string>,
"subTypes": [
{
"type": <string>,
"subTypes": ...
}
...
]
},
...
]
ParameterDescription
typeA string identifying the object type.
subTypesA list of sub classifiers for a defined type.

Perspective

"perspective": {
"minNbrBars": <int>,
"maxNbrBars": <int>,
"minNbrPerspectivesPerScenario": <int>,
"maxNbrPerspectivesPerScenario": <int>,
"minHeight": <int>,
"maxHeight": <int>,
"defaultHeight": <int>,
"minNbrPerspectives": <int>,
"maxNbrPerspectives": <int>
}
ParameterDescription
minNbrBars/maxNbrBarsThe min/max number of allowed perspective bars.
minNbrPerspectivesPerScenario/maxNbrPerspectivesPerScenarioThe min/max number of allowed perspectives per scenario.
minHeight/maxHeightThe min/max height of a perspective bar.
defaultHeightThe default height of a perspective bar.
minNbrPerspectives/maxNbrPerspectivesThe min/max number of allowed perspectives in a configuration.

Scenarios

"scenarios": {
"minNbrScenariosPerCamera": <int>,
"maxNbrScenariosPerCamera": <int>,
"minNbrActiveDevices": <int>,
"maxNbrActiveDevices": <int>,
"minNbrDevices": <int>,
"maxNbrDevices": <int>,
"minLengthName": <int>,
"maxLengthName": <int>,
"defaultScenario": <string>,
"defaultDeviceId": <string>,
"supportedScenarios": [<string>, <string>, ...]
"alarmRates": [<string>, <string>, ...],
"defaultAlarmRate": <string>,
"accumulatedCounts": {
...
},
"passthroughConfiguration": {
...
},
"thresholdConfiguration": {
...
}
}
ParameterDescription
minNbrScenariosPerCamera/maxNbrScenariosPerCameraThe min/max number of supported scenarios for each device or camera.
minNbrActiveDevices/maxNbrActiveDevicesThe min/max total number of devices all devices are able to collectively use.
minNbrDevices/maxNbrDevicesThe min/max number of devices one single scenario can use.
minLengthName/maxLengthNameThe min/max length of the scenario name string.
defaultScenarioThe default scenario type.
defaultDeviceIdA list device ID when a creating a default scenario.
supportedScenariosA list of supported scenarios as strings.
alarmRatesA list of supported alarm rates as strings.
defaultAlarmRateThe default alarm rate.

Accumulated counts

{
"defaultTimedResetEnabled": <boolean>
}
ParameterDescription
defaultTimedResetEnabledIndicates if the timed reset for accumulated counts is active per default.

Passthrough configuration

{
"defaultEnabled": <boolean>,
"minPeriod": <int>,
"maxPeriod": <int>
}
ParameterDescription
defaultEnabledIndicates if the passthrough event is active per default.
minPeriod/maxPeriodThe min/max period that passthrough events can be triggered for.

Threshold configuration

{
"defaultEnabled": <boolean>,
"minLevelWithMoreThanType": <int>,
"minTriggerDelay": <int>,
"defaultLevel": <int>,
"defaultType": <string>,
"minLevelWithLessThanType": <int>,
"defaultTriggerDelay": <int>,
"maxLevel": <int>,
"maxTriggerDelay": <int>
}
ParameterDescription
defaultEnabledIndicates if the occupancy threshold events are active per default.
minLevelWithMoreThanType/minLevelWithLessThanTypeThe minimum threshold level when using either MoreThan or LessThan threshold type.
minTriggerDelay/maxTriggerDelayThe minimum/maximum configured delay for when events are triggered after reaching the threshold.
defaultLevelThe default threshold level.
defaultTypeThe default threshold type.
defaultTriggerDelayThe default trigger delay.

Triggers

This array contains the supported trigger types, while the contents of a trigger object depends on the type parameter.

"triggers": [
{
"type": <string>,
...
},
...
]

Include area

{
"type": "includeArea",
"minPosX": <real>,
"maxPosX": <real>,
"minPosY": <real>,
"maxPosY": <real>,
"minNbrVertices": <int>,
"maxNbrVertices": <int>,
"minNbrInstances": <int>,
"maxNbrInstances": <int>,
"defaultInstance": [
[<real>, <real>],
[<real>, <real>],
[<real>, <real>],
[<real>, <real>]
]
}
ParameterDescription
minPosX/maxPosX/minPosY/maxPosYFour values that defines the area in which creating an include area is valid.
minNbrVertices/maxNbrVerticesThe min/max number of vertices that area can contain.
minNbrInstances/maxNbrInstancesThe min/max allowed number of include areas in a scenario.
defaultInstanceAn array of vertices defining a reference include area [x1, y1], [x2, y2], ... etc.

Fence

{
"type": "fence",
"minPosX": <real>,
"maxPosX": <real>,
"minPosY": <real>,
"maxPosY": <real>,
"minNbrVertices": <int>,
"maxNbrVertices": <int>,
"minNbrInstances": <int>,
"maxNbrInstances": <int>,
"validAlarmDirections": [<string>, ...],
"defaultAlarmDirection": <string>,
"defaultInstance": [
[<real>, <real>],
[<real>, <real>]
]
}
ParameterDescription
minPosX/maxPosX/minPosY/maxPosYFour values that defines the area in which creating a fence area is valid.
minNbrVertices/maxNbrVerticesThe min/max number of vertices that fence polyline can contain.
minNbrInstances/maxNbrInstancesThe min/max allowed number of fences in a scenario.
validAlarmDirectionsA list of strings containing valid alarm directions. See Scenario triggers for additional information.
defaultAlarmDirectionSee Scenario triggers for additional information.
defaultInstanceAn array of vertices defining a reference fence polyline[x1, y1], [x2, y2], ... etc.

Counting line

{
"type": "countingLine",
"minPosX": <real>,
"maxPosX": <real>,
"minPosY": <real>,
"maxPosY": <real>,
"minNbrVertices": <int>,
"maxNbrVertices": <int>,
"minNbrInstances": <int>,
"maxNbrInstances": <int>,
"validCountingDirections": [<string>, ...],
"defaultCountingDirection": <string>,
"defaultInstance": [
[<real>, <real>],
[<real>, <real>]
]
}
ParameterDescription
minPosX/maxPosX/minPosY/maxPosYFour values that defines the area in which creating a counting line is valid.
minNbrVertices/maxNbrVerticesThe min/max number of vertices the polyline can contain.
minNbrInstances/maxNbrInstancesThe min/max allowed number of counting lines in a Crossline Counting Scenario.
validAlarmDirectionsA list of strings containing valid counting directions. See Scenario triggers for additional information.
defaultAlarmDirectionSee Scenario triggers for additional information.
defaultInstanceAn array of vertices defining a reference polyline [x1, y1], [x2, y2], ... etc.

Presets

This property is only included if the camera supports PTZ presets.

{
"minNbrPresetsPerScenario": <int>,
"maxNbrPresetsPerScenario": <int>,
"defaultPreset": <int>
}
ParameterDescription
minNbrPresetsPerScenario/maxNbrPresetsPerScenarioThe min/max number of presets allowed in the scenario presets array.
defaultPresetThe default preset for the camera on which the application is running. See Scenario PTZ presets for additional information.