Download as pdf or txt
Download as pdf or txt
You are on page 1of 1

Exercise 3.

Event Visualizer on ROS

In this exercise, we start from a minimum working version of a ROS package, called dvs_displayer, and
will incrementally add new functionalities to it.
The functionalities are the following:

1. First, understand the minimum working example of the given ROS node.

2. Add one parameter and branch (with an if/else) to show color image

(a) In this part, the goal is to add a variable in the code and display either a grayscale event frame
or a color one (in red and blue over a white background, where the color is determined by the
polarity of the last event in the ROS message at each pixel).

(b) Tasks: add a variable, loop through the events and paint the image pixels with red or blue, then
publish the image on ROS.

3. Add grayscale image (from the DAVIS camera)

(a) In this section, the goal is to add a subscriber to read the grayscale frames that are published
on the topic /dvs/image_raw. Thus, we need to add a callback function (similar to the existing
event call back function) to process the images. In this case, we store the image in a member
variable of the Displayer class, so that it can be used later, in the event call back function.

4. Plot events on top of grayscale image (frame from a DAVIS camera)

(a) In this section, the goal is to plot the events on the grayscale image that has been stored during
the execution of the image call back.

5. Add an OpenCV colormap to visualize the events

(a) In this part, we replace the red-blue event display with a colored version of the grayscale events. We
apply a colormap using OpenCV (cv::applyColorMap and cv::COLORMAP_JET) and combine
the DAVIS frame (from the topic /dvs/image_raw) with the colored events, using the OpenCV
function cv::addWeighted.

6. Add custom colormap to visualize the events

(a) (This could be skipped, if running out of time). We are not satised with OpenCV's colormaps,
so we use our own, to replicate the one that we had in Exercise 2 (the seismic colormap), that we
used and was created with matplotlib. Use OpenCV functions cv::cvtColor and cv::LUT. Write
the colormap look-up-table in a separate le, such as src/custom_cmaps.cpp, and don't forget to
include it in the CMakeLists.txt le.

7. Add Dynamic Recongure of parameters

(a) In this part, the goal is to add some parameters for interactivity, so that we are able to change the
behavior of the ROS node while it is being executed. First, we add the code to add one parameter
(we will create a cfg folder and le) and add <depend>dynamic_recongure</depend> to the
package.xml le. Let us add a variable to change among dierent color maps.

8. Add blending parameters

(a) In this part, the goal is to add more parameters to the dynamic recongure code. We already
know how to add one parameter (from the previous step; it was an integer parameter), and now
we want to add two additional parameters (a boolean and a double). The boolean will enable
or disable the alpha-blending display mode, and the double will control the parameter α of the
alpha-blending (parameter α in the OpenCV function (cv::addWeighted).

You might also like