Designer Analytics API

class metavision_designer_analytics.CountingFilter(self: metavision_designer_analytics.CountingFilter, source: metavision_designer_engine.Producer, width: int, height: int, object_min_size: float, object_average_speed: float, distance_object_camera: float)None

Builds a new CountingFilter object

Parameters
  • source (Producer) – Producer component pointer providing an event stream used for object counting

  • width (int) – Sensor’s width

  • height (int) – Sensor’s height

  • object_min_size (float) – Approximate minimum size of an object to count (its largest dimension, in mm)

  • object_average_speed (float) – Approximate average speed of an object to count (in m/s)

  • distance_object_camera (float) – Average distance between the flow of objects to count and the camera (in mm)

add_line_counter(self: metavision_designer_analytics.CountingFilter, row: int)None

Adds a line counter

Parameters

row (int) – Row used for object counting

class metavision_designer_analytics.CountingFrameGenerator(self: metavision_designer_analytics.CountingFrameGenerator, arg0: metavision_designer_engine.Producer, arg1: metavision_designer_engine.Producer, arg2: int, arg3: int)None

Displays counting results on top of CD events.

Parameters
  • cd_source (Producer) – Pointer to the producer of CD events

  • counting_source (Producer) – Pointer to the producer of counting results

  • width (int) – Sensor’s width

  • height (int) – Sensor’s height

add_line_counter(self: metavision_designer_analytics.CountingFrameGenerator, row: int)None

Adds a line counter

Parameters

row (int) – Row used for object counting

class metavision_designer_analytics.FrequencyMapFilter(self: metavision_designer_analytics.FrequencyMapFilter, source: metavision_designer_engine.Producer, update_frequency: float, filter_length: int = 7, min_freq: float = 10, max_freq: float = 150, diff_thresh: int = 1500)None

Computes frequency map from an EventCD producer.

This component computes frequency maps from a stream of CD events. A frequency map is a 2D array storing for each pixel the frequency of the observed signal or 0 if no frequency could be reliably estimated. The frequency map is written to the 2D array output of the component, to be consumed by a renderer or a 2D array consumer. Commodity class FrequencyMapFrameGenerator is also provided to offer some control on how to display the frequency map. The frequency is computed by analyzing the consecutive frequency estimates: if it is stable for a fixed number of repetitions, the frequency is written to the output frequencymap. The number of repetitions is controlled by the filter_length parameter. Depending on application requirements on expected frequencies it might be also useful to tune the diff_thresh parameter to control the absolute error in frequency estimation.

Parameters
  • source (Producer) – Component providing the EventCD stream.

  • update_frequency (float) – Computation frequency. Note that this parameter must be consistent with the expected renderer’s rate used in the application

  • filter_length (int, optional) – Number of frequencies to detect before outputting a value in the frequency map. Default is 7

  • min_freq (float, optional) – Minimum frequency to output, in us. Default is 10 Hz

  • max_freq (float, optional) – Maximum frequency to output, in us. Default is 150 Hz

  • diff_thresh (int, optional) – Absolute max time difference allowed between 2 consecutive frequencies for the same pixel to be considered the same, in microseconds. Defaults is 1500

class metavision_designer_analytics.FrequencyMapFrameGenerator(self: metavision_designer_analytics.FrequencyMapFrameGenerator, source: metavision_designer_engine.Producer, fps: float, min_freq: float, max_freq: float, freq_precision: float, min_pixel_count: int)None

Computes a 2D frame from a frequency map for display purposes.

Consumes frequency maps typically from a FrequencyMapFilter and builds a 2D frame for display. The 2D frame display shows color coded frequencies and automatically extracts the dominant frequency value. 2D frame produced by a FrequencyMapFrameGenerator component can typically be consumed by any renderer like ImageDisplayCV or VideoWriter.

Parameters
  • source (Producer) – Frequency map producer.

  • fps (float) – Output 2D frame rate. Note that it must be consistent with the renderer frequency

  • min_freq (float) – Minimum frequency, in Hz

  • max_freq (float) – Maximum frequency, in Hz

  • freq_precision (float) – Precision for the frequency calculation, in Hz

  • min_pixel_count (int) – Minimum required number of pixels with the same frequency to consider the dominant frequency as valid

class metavision_designer_analytics.PeriodMapFilter(self: metavision_designer_analytics.PeriodMapFilter, source: metavision_designer_engine.Producer, update_frequency: float, filter_length: int = 7, min_period: float = 6500, max_period: float = 100000.0, diff_thresh: int = 1500)None

Computes period map from an EventCD producer.

This component computes period maps from a stream of CD events. A period map is a 2D array storing for each pixel the period of the observed periodic signal or 0 if no period could be reliably estimated. The period map is written to the 2D array output of the component, to be consumed by a renderer or a 2D array consumer. Commodity class FrequencyMapFrameGenerator is also provided to offer some control on how to display the period map. The period is computed by analyzing the consecutive period estimates: if it is stable for a fixed number of repetitions, the period is written to the output periodmap. The number of repetitions is controlled by the filter_length parameter. Depending on application requirements on expected periods (or frequencies) it might be also useful to tune the diff_thresh parameter to control the absolute error in period estimation.

Parameters
  • source (Producer) – Component providing the EventCD stream

  • update_frequency (float) – Computation periodicity. Note that this parameter must be consistent with the expected renderer’s rate used in the application

  • filter_length (int, optional) – Number of periods to detect before outputting a value in the period map. Default is 7

  • min_period (float, optional) – Minimum period to output, in Hz. Default is 6500us, which corresponds to 153Hz

  • max_period (float, optional) – Maximum period to output, in Hz. Default is 1e5us, which corresponds to 10Hz

  • diff_thresh (int, optional) – Absolute max time difference allowed between 2 consecutive periods to be considered the same for the same pixel, in microseconds. Default is 1500

class metavision_designer_analytics.SpatterFrameGenerator(self: metavision_designer_analytics.SpatterFrameGenerator, cd_source: metavision_designer_engine.Producer, spatter_source: metavision_designer_engine.Producer)None

Commodity class used to display EventSpatterClusters in a 2D Frame.

Consumes 2 event streams: one CD event source to draw the events and a SpatterTracker event source to draw the tracked clusters. Produces a 2D frame output ready to be consumed by standard renderers. See SpatterTrackerFilter to generate spatter events.

Parameters
  • cd_source (Producer) – CD event source

  • spatter_source (Producer) – Spatter event source

class metavision_designer_analytics.SpatterTrackerFilter(self: metavision_designer_analytics.SpatterTrackerFilter, source: metavision_designer_engine.Producer, cell_width: int = 7, cell_height: int = 7, accumulation: int = 5000, untracked_threshold: int = 5, activation_threshold: int = 10, apply_filter: bool = True, max_distance: int = 50, min_size: int = 1, max_size: int = 2147483647)None

Tracks spatter-like objects: diverging particles with smooth motion.

SpatterTrackerFilter consumes events from an EventCD producer and generates an EventSpatterCluster stream. An EventSpatterCluster is a cluster of events represented by a bounding box and a cluster id. Spatter tracker uses a grid subdivision of the sensor pixel array, and identifies active cells based on the number of events per cell. Clusters are then created and associated to the active cells. Clusters can be visualized using a SpatterFrameGenerator.

Parameters
  • source (Producer) – Input EventCD stream producer

  • cell_width (int, optional) – Width of the cells. Defaults to 7

  • cell_height (int, optional) – Height of the cells. Defaults to 7

  • accumulation (int, optional) – Time slice used for computation. Defaults to 5000

  • untracked_threshold (int, optional) – Parameter used for deleting non-tracked clusters. A cluster is deleted, if it was not tracked during this number of consecutive time slices. Defaults to 5

  • activation_threshold (int, optional) – Minimum number of events in a cell to create a cluster. Defaults to 10

  • apply_filter (bool, optional) – Apply the filter to prevent tracking background noise. Defaults to true

  • max_distance (int, optional) – Maximum matching distance. Defaults to 50

  • min_size (int, optional) – Minimum size for a cluster, in pixels. Defaults to 1

  • max_size (int, optional) – Maximum size for a cluster, in pixels. Defaults to maximum available

get_cluster_count(self: metavision_designer_analytics.SpatterTrackerFilter)int

Gets the current number of clusters

Returns

Current number of clusters

Return type

int

class metavision_designer_analytics.TrackingFilter(self: metavision_designer_analytics.TrackingFilter, arg0: metavision_designer_engine.Producer, arg1: int, arg2: int, arg3: Metavision::TrackingConfig)None

Builds a new TrackingFilter object.

Parameters
  • source (Producer) – Producer component providing an event stream used for tracking objects

  • width (int) – Width of the stream (in pixels)

  • height (int) – Height of the stream (in pixels)

  • config (TrackingConfig) – Reference of tracking configuration

get_max_size(self: metavision_designer_analytics.TrackingFilter)int

Gets the size of the largest trackable object

Returns

Size of the largest trackable object

Return type

int

get_min_size(self: metavision_designer_analytics.TrackingFilter)int

Gets the size of the smallest trackable object

Returns

Size of the smallest trackable object

Return type

int

set_max_size(self: metavision_designer_analytics.TrackingFilter, max_size: int)None

Sets the size of the largest trackable object

Parameters

max_size (int) – Size of the largest trackable object

set_min_size(self: metavision_designer_analytics.TrackingFilter, min_size: int)None

Sets the size of the smallest trackable object

Parameters

min_size (int) – Size of the smallest trackable object

class metavision_designer_analytics.TrackingFrameGenerator(self: metavision_designer_analytics.TrackingFrameGenerator, arg0: metavision_designer_engine.Producer, arg1: metavision_designer_engine.Producer, arg2: int, arg3: int)None

Displays tracking results (e.g. bounding boxes) on top of CD events.

Parameters
  • cd_source (Producer) – Pointer to the CD event producer

  • tracker_source (Producer) – Pointer to the producer of tracking results

  • width (int) – Sensor’s width

  • height (int) – Sensor’s height