Pre-requisites
You must have an existing image with an associated media_id
Use the media_id to send the PUT request to the endpoint /predict/v2/images/media_id/aois
Expected request payload
For each Area of Interest (AOI), there need to be , at least, 3 points, with both x (horizontal) and y (vertical) coordinates, so that a triangle, rectangle, or polygon can be set as the AOI.
Note: The coordinates for the points must be values within the interval 0 and 1, because it corresponds to the position relative to the with or height of the image, so values like -0.3 or 1.56 will not be valid.
{
"aois": {
"my-scustom-aoi": {
"points": [
{
"x": 0.10,
"y": 0.10
},
{
"x": 0.10,
"y": 0.30
},
{
"x": 0.40,
"y": 0.30
},
{
"x": 0.40,
"y": 0.10
}
],
"name": "API testing",
"autodetected": false,
"hidden": false
}
}
}
Example of a successful response
Upon updating the AOIs in your image, the successful response look should look like the snippet below.
NOTE: Every time you call this endpoint, it will completely overwrite the AOIs in your image so, if you want to append an AOI or edit an existing one, make sure to pass the current AOIs object with the appropriate changes.
{
"aois": {
"my-custom-aoi": {
"spec": {
"points": [
{
"x": 0.1,
"y": 0.1
},
{
"x": 0.1,
"y": 0.3
},
{
"x": 0.4,
"y": 0.3
},
{
"x": 0.4,
"y": 0.1
}
],
"name": "AOI testing",
"autodetected": false
},
"attentionpercent": 3.0183477327227592,
"focus_first_two": 4.848102107644081,
"focus_last_two": 0.6302486639469862,
"cognitive_percent": 0.9335138729779904,
"clarity_percent": 6.58610862724483,
"engagement_percent": 3.8307876538485286,
"percentage_seen": 17.595168063907714,
"tot_fix_duration": 0.20957151052745265
}
},
"version": "AOI_IMG_20232809_TIME-SPENT-SCALE-FIX"
}