Building Pipeline

Metavision SDK contains a set of C++ utility classes aimed at simplifying the implementation of algorithms using data pipelines.

The Pipeline class allows you to organize data processing in a pipeline of processing units, called stages, and control their execution. In a pipeline, each processing stage can have previous stages and next stages, thus forming a directed graph, for example:

../../_images/pipeline_idea.png

In a pipeline, the goal of each stage is to perform some processes, typically from input data, and output data for the next stages. The type of input and output data from a stage does not need to be the same. For example, a stage could take a buffer of Event2d as input and output a buffer of Event2dPeriod. As another example, a stage could take EventCD as input and generate cv::Mat as output. It is also possible for stages to have no input data or no output data. Most stages extend from the BaseStage class.

The main advantages of using the Pipeline class are:

  • it transparently manages data transfer, without unnecessary copies;

  • it manages multi-threading, allowing to easily run each stage in its own thread if needed.

In the next sections, we will present how to use pipelines, and we will provide some examples of how to build pipelines and create custom stages.

Note

The SDK pipeline class is not the only way to process events with multiple algorithms in a row. As mentioned above, SDK pipelines simplify the code, but also comes with some limitations (e.g. some pipelines flows can not be implemented). And if you want to discover our SDK from the ground up, you might prefer to start with some code samples that don’t use the pipelines. A good example of such a sample is metavision_psm that leverages PsmAlgorithm, PolarityFilterAlgorithm, TransposeEventsAlgorithm and ActivityNoiseFilterAlgorithm.

To process events, you could also consider using a third-party tool like ROS with our ROS Wrapper or MVTec HALCON using our Acquisition Interface.