Additional conditions match all kinds of requests. Conditions are always joined with logical “AND”. For instance, the “object of height not more than a quarter of the frame that is in the camera field of view for 5 seconds” request looks like this:
{ "queryType": "zone", "figures": [ { "shape": [ [0.3, 0.3], [0.7, 0.3], [0.7, 0.7], [0.3, 0.7] ] } ], "objectProperties": { "size": { "height": [0, 0.25] } }, "conditions": { "duration": 5 } }
Object type (objectProperties/category
)
An object can be abandoned or moving (face, human, group, vehicle). In the request abandoned type cannot be mixed with other object types (otherwise the abandoned requirement will be ignored).
Search for objects abandoned in any point of the frame looks like this:
{ "queryType": "zone", "figures": [ { "shape": [ [0, 0], [1, 0], [1, 1], [0, 1] ] } ], "objectProperties": { "category": ["abandoned"], } }
The search for a human or a small group of people crossing the line looks like this:
{ "queryType": "line", "figures": [ { "shape": [ [0.5, 0.8], [0.5, 0.2] ] } ] "objectProperties": { "category": ["human", "group"], } }
Object size (objectProperties/size
)
It sets minimum and maximum width and height of an object.
For instance, to find objects that are not bigger than a quarter of the frame in height one can use this request:
:
{ "queryType": "zone", "figures": [ { "shape": [ [0.3, 0.3], [0.7, 0.3], [0.7, 0.7], [0.3, 0.7] ] } ], "objectProperties": { "size": { "width": [0, 1], "height": [0, 0.25] } } }
As both dimensions are not necessary to be set, this request will be similar to the previous one:
{ "queryType": "zone", "figures": [ { "shape": [ [0.3, 0.3], [0.7, 0.3], [0.7, 0.7], [0.3, 0.7] ] } ], "objectProperties": { "size": { "height": [0, 0.25] } } }
Object color (objectProperties/color
)
It sets minimum and maximum coordinates of the object color in HSV space. hue is measured in degrees (from 0 to 360), saturation and brightness – in fractions from 0 to 1.
The request to get bright green objects in the zone looks like this:
{ "queryType": "zone", "figures": [ { "shape": [ [0.3, 0.3], [0.7, 0.3], [0.7, 0.7], [0.3, 0.7] ] } ], "objectProperties": { "color": { "hue": [75, 135], "saturation": [0.5, 1], "brightness": [0.5, 1] } } }
In HSV space dark almost black colors can have any hue and saturation. So to search black objects the request should look like this:
{ "queryType": "zone", "figures": [ { "shape": [ [0.3, 0.3], [0.7, 0.3], [0.7, 0.7], [0.3, 0.7] ] } ], "objectProperties": { "color": { "hue": [0, 360], "saturation": [0, 1], "brightness": [0, 0.2] } } }
Here is the same request for white objects:
{ "queryType": "zone", "figures": [ { "shape": [ [0.3, 0.3], [0.7, 0.3], [0.7, 0.7], [0.3, 0.7] ] } ], "objectProperties": { "color": { "hue": [0, 360], "saturation": [0, 0.1], "brightness": [0.8, 1] } } }
Velocity (conditions/velocity
)
It sets minimum and maximum velocity of the object.
It is measured in frame rates per second – i.e. the velocity of the object moving from the left edge of the frame to the right one over 1 second is 1.
.
{ "queryType": "zone", "figures": [ { "shape": [ [0.3, 0.3], [0.7, 0.3], [0.7, 0.7], [0.3, 0.7] ] } ], "conditions": { "velocity": [0.25, 1] } }
Directions (conditions/directions
)
It sets the direction for the object as an array of angles. Angles are measured in radians and are counted from the axis directed to the right clockwise.
So the request to get objects moving to the right ±45° looks like this:
:
{ "queryType": "zone", "figures": [ { "shape": [ [0.3, 0.3], [0.7, 0.3], [0.7, 0.7], [0.3, 0.7] ] } ], "conditions": { "directions": [ [315, 45] ] } }
Pay attention that 45° -- 315° angle covers all directions except “to the right”.
If one needs to find objects moving mainly horizontally, then two angles are to be set:
{ "queryType": "zone", "figures": [ { "shape": [ [0.3, 0.3], [0.7, 0.3], [0.7, 0.7], [0.3, 0.7] ] } ], "conditions": { "directions": [ [315, 45], [135, 225] ] } }
Duration (conditions/duration
)
It sets time (in seconds) during which the object is to continuously meet all conditions.
Using this condition one can make the “long presence in the zone” request:
:
{ "queryType": "zone", "figures": [ { "shape": [ [0.3, 0.3], [0.7, 0.3], [0.7, 0.7], [0.3, 0.7] ] } ], "conditions": { "duration": 5 } }
Object number (condtions/count
)
It sets the minimum required number of objects that simultaneously meet other request conditions.
It is usually used for search of a big number of objects in the zone. For instance:
{ "queryType": "zone", "figures": [ { "shape": [ [0.3, 0.3], [0.7, 0.3], [0.7, 0.7], [0.3, 0.7] ] } ], "conditions": { "count": 3 } }