You can integrate your own viewer plugin libraries with the ADAS library to display custom content
based on sensor input. Typically, this is used to implement algorithms that generate an output
that differs from the original sensor input. For example, this can be used to implement an edge detection
algorithm that will display an edge map instead of the original content of the camera input.
To integrate your viewer plugin, you need to do the following:
- In your viewer plugin library, implement the following functions from
the adas_viewer_plugin.h header file:
- init
- For more information, see adas_viewer_plugin_init_t.
- deinit
- For more information, see adas_viewer_plugin_deinit_t.
- program
- For more information, see adas_viewer_plugin_program_t.
- process frame
- For more information, see adas_viewer_plugin_process_t.
-
Create an instance of adas_viewer_plugin_t
called adas_viewer_plugin_defs and assign your function
implementations to the various function pointer fields.
adas_viewer_plugin_t adas_viewer_plugin_defs = {
.init = my_init_function,
.program = my_program_function,
.process_frame = my_process_frame_function,
.deinit = my_deinit_function
};
-
In the file that declares adas_viewer_plugin_defs, you need to specify #define ADAS_VIEWER_PLUGIN_API_IMPLEMENT
prior to including adas_viewer_plugin.h or any other ADAS library header file. This is necessary to
ensure backwards compatibility with future versions of the library. This can be done as follows:
#define ADAS_VIEWER_PLUGIN_API_IMPLEMENT
#include <adas/adas_viewer_plugin.h>
-
Configure the viewer property by specifying a path of ADAS_VIEWER_NATIVE_CAMERA and
the path of the viewer plugin library. For example:
"viewer":
{
"type": "ADAS_VIEWER_NATIVE_CAMERA",
"view": "ADAS_VIEW_DRIVER",
"window_format": "nv16",
"path": "libviewer_plugin.so",
"input": [
{
"id": "front"
}
],
"visible": "true"
}