Tutorial 5: Flip events from upside down record

In this tutorial you will learn how to use Metavision Designer components to flip events on X and Y axis. Useful if, for example, your events data was recorded with an upside down event-based camera. Flipping X AND flipping Y actually does a 180° rotation.


import metavision_designer_engine as mvd_engine
import metavision_designer_core as mvd_core

input_path = 'PATH_TO_DAT'

# Create controller
controller = mvd_engine.Controller()

# Create producer
cd_prod = mvd_core.FileProducer(input_path)
controller.add_component(cd_prod, "Events producer")

Building the pipeline

We will now create the pipeline by adding the different components to the controller.

In this tutorial we will implement the following pipeline: image0 Let’s now instantiate the components.

FlipXFilter component is used to flip events on the X axis (width), from left to right and right to left. Creation of FlipXFilter requires 1 argument: the component producing the events (here, cd_prod).

The FlipYFilter component is used to flip events on the y axis (height), from top to bottom and bottom to top. Creation of FlipYFilter requires 1 argument: the component producing the events (here, FlipXFilter).

flip_x_filter = mvd_core.FlipXFilter(cd_prod)
controller.add_component(flip_x_filter, "Flip X filter")

flip_y_filter = mvd_core.FlipYFilter(flip_x_filter)
controller.add_component(flip_y_filter, "Flip Y filter")

Then instantiate the other components. Note that input of the FrameGenerator is “flip_y_filter”

#frame generator, that will create frames from events
frame_gen = mvd_core.FrameGenerator(flip_y_filter)

#ImageDisplayCV to display the frames generated by frame_gen
img_disp = mvd_core.ImageDisplayCV(frame_gen)
controller.add_renderer(img_disp, mvd_engine.Controller.RenderingMode.SimulationClock, 25.)

We are all set! Let’s now run the pipeline and display the events, flipped on X and Y Axis.

while not (controller.is_done()):


The expected output is the following:

We finally delete the graphical components, to stop the tutorial properly.

del img_disp


This tutorial was created using Jupiter Notebooks

Download the source code.