Documentation for C-Werk 2.0.

Previous page Additional conditions  'Familiar face'-'stranger' face search API Next page

On page:

Object in the zone (queryType="zone")

figures/shape is a required parameter. It sets the zone the object to be within as the list of polygon apexes. Coordinates are set in fractions of frame width/height (values from 0 to 1). It allows not to be tied to specific camera resolution.

The simplest request looks like this:

{
    "queryType": "zone",
    "figures": [
        {
            "shape": [
                [0.3, 0.3],
                [0.7, 0.3],
                [0.7, 0.7],
                [0.3, 0.7]
            ]
        }
    ]
}

Here the zone describes the rectangular in the centre of camera field of view.

queryProperties/action is an optional parameter of the request:

  • If this parameter is not set, then objects in the zone are searched.
  • queryProperties/action="enter" − objects entering the zone are searched.
  • queryProperties/action="exit" − objects exiting the zone are searched.

Here is an example of request for objects entering the zone:

{
    "queryType": "zone",
    "figures": [
        {
            "shape": [
                [0.3, 0.3],
                [0.7, 0.3],
                [0.7, 0.7],
                [0.3, 0.7]
            ]
        }
    ],
    "queryProperties": {
        "action": "enter"
    }
}

Object transition from one zone to another (queryType="transition")

There is one required parameter − figures. It has to contain two zones describing start and end zones.

There are no optional parameters.

Search for objects that moved from the left part of the frame to the right one:

 {
    "queryType": "transition",
    "figures": [
        {
            "shape": [
                [0, 0],
                [0.45, 0],
                [0.45, 1],
                [0, 1]
            ]
        },
        {
            "shape": [
                [0.55, 0],
                [1, 0],
                [1, 1],
                [0.55, 1]
            ]
        }
    ]
}

Line crossing (queryType="line")

Required parameter figures defines a segment crossing of which triggers the condition. The segment is to be set by two points.

 {
    "queryType": "line",
    "figures": [
        {
            "shape": [
                [0.5, 0.8],
                [0.5, 0.2]
            ]
        }
    ]
}

Optional parameter queryProperties/direction sets direction of line crossing.

  • If this parameter is not set, then objects crossing the line in any direction will be in results.
  • queryProperties/direction="left" means that the object is to cross the line from the right to the left if look from the right point of the segment.
  • queryProperties/direction="right" means that the object is to cross the line from the left to the right if look from the right point of the segment.
 {
    "queryType": "line",
    "figures": [
        {
            "shape": [
                [0.5, 0.8],
                [0.5, 0.2]
            ]
        }
    ],
    "queryProperties": {
        "direction": "left"
    }
}
  • No labels