# Designer Analytics API¶

class metavision_designer_analytics.CountingFilter

Builds a new CountingFilter object

Args:

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)

configuration_file (string): Path to a JSON file that will be written during calibration

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

Args:

row (int): Row used for object counting

class metavision_designer_analytics.CountingFrameGenerator

Displays counting results on top of CD events.

Args:

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

Args:

row (int): Row used for object counting

class metavision_designer_analytics.FrequencyMapFilter

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.

Args:

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

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 FrequencyMapGenerator component can typically be consumed by any renderer like ImageDisplayCV or VideoWriter.

Args:

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

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.

Args:

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

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.

Args:

cd_source (Producer): CD event source

spatter_source (Producer): Spatter event source

class metavision_designer_analytics.SpatterTrackerFilter

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.

Args:

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:

int: Current number of clusters

class metavision_designer_analytics.TrackingFilter

Builds a new TrackingFilter object.

Args:

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:

int: Size of the largest trackable object

get_min_size(self: metavision_designer_analytics.TrackingFilter) → int

Gets the size of the smallest trackable object

Returns:

int: Size of the smallest trackable object

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

Sets the size of the largest trackable object

Args:

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

Args:

min_size (int): Size of the smallest trackable object

class metavision_designer_analytics.TrackingFrameGenerator

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

Args:

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