Arrays in Adaptive Vision Studio
An array is a collection composed of zero, one or many elements of the same type. In Adaptive Vision Studio for any type X there is a corresponding XArray type, including XArrayArray. For example, there are types: Point2D, Point2DArray, Point2DArrayArray and more.
Arrays are very similar to the std::vector class template in C++. As one can have std::vector < std::vector< atl::Point2D > > in C++, there is also Point2DArrayArray in Adaptive Vision Studio.
Generic Filters for Arrays
Arrays can be processed using a wide range of generic filters available in the categories:
Each of these filters requires instantiation with an appropriate element type to assure that no mistakes are later made when connections are created. Here is an example usage of the TestArrayNotEmpty filter, which has an input of the RegionArray type:
When a scalar value, e.g. a Region, is connected to an input of an array type, e.g. RegionArray, an automatic conversion to a single-element array may be performed. This feature is available for selected filters and cannot be used at inputs of macrofilters.
When an array, e.g. a RegionArray, is connected to an input of a scalar type, e.g. Region, the second filter is executed many times, once per each input data element. We call it the array mode. Output data from all the iterations are then merged into a single output array. In the user interface a "" symbol is added to the filter name and the output types are changed from T to T(Array). The brackets distinguish array types which were created due to array mode from those which are native for the specific filter.
For example, in the program fragment below an array of blobs (regions) is connected to a filter computing the area of a single region. This filter is independently executed for each input blob and produces an array of Integers on its output.
- If the input array connected to a scalar input is empty, then the filter will not be executed at all and empty arrays will be produced on the outputs.
- If there are multiple array connections at a single filter instance, then all of the input arrays must be of the same length. Otherwise a domain error is signaled. For more information on this topic see: Array Synchronization.