Using Custom Algorithms

You can integrate custom algorithms to be used by applications built using the ADAS library

You can use hooks to create a library to support your custom algorithms. To integrate your custom algorithm, you do the following steps:

  1. Provide your custom algorithm library with implementations for the following functions from the adas_external_algo.h header file:
    probe(adas_fusion_algo_preferences_t *preferences)
    For information about the function arguments to implement, see adas_fusion_algo_probe_t.”
    open(uint32_t id, adas_fusion_algo_handle_t *return_handle, char *params)
    For information about the function arguments to implement, see adas_fusion_algo_open_t.”
    process_sensor_buffer(adas_fusion_algo_handle_t algo_handle, const adas_sensor_properties_t *sensor_properties, const adas_sensor_buffer_t * sensor_buffer, const adas_fusion_buffer_t ** return_buffer)
    For information about the function arguments to implement, see adas_fusion_algo_process_sensor_buffer_t.”
    close(adas_fusion_algo_handle_t algo_handle)
    For information about the function arguments to implement, see adas_fusion_algo_close_t.”
  2. Create an instance called adas_ext_algorithm_defs and assign your camera driver functions using the adas_ext_algorithm_t opaque type, which is a typedef of the adas_ext_algorithm.”
    adas_ext_algorithm_t adas_ext_algorithm_defs  = {
    .probe = my_probe_function,
    .open = my_open_algo_instance_function,
    .process_sensor_buffer = my_process_buffer_function,
    .close = my_close_function
    };
    Note: In your algorithm, you must use adas_ext_algorithm_defs to declare your variable name for the structure adas_ext_algorithm_t. The ADAS library links the algorithm to integrate it.
  3. Configure the algorithm attribute using the id set to ADAS_ALGO_CUSTOM and the path set to the location of your custom algorithm library in the ADAS library configuration file. Optionally, you can use the parameters attribute to pass a string to the library. For more information about the Algorithm attribute in the ADAS library configuration file, see Algorithm.” For example:
    {
    ...
    ...
    "algorithm": [
            {
                "id": "ADAS_ALGO_CUSTOM",
                "path": "libfinger_count_algo_example.so",
                "parameters": "five"
                "input": [
                    {
                        "id": "forward_camera"
                    }
                ],
                "output": [
                    {
                        "type": "viewer",
                        "instance": 1
                    }
                ]
            }
        ],
    ...
    ...

Examples of using custom algorithms are available with the QNX Platform for ADAS from the QNX Software Center. See the source directory for more information in your host installation at $QNX_BASE/source/adas-opencv-examples-version.zip. After you extract the ZIP file, you'll find the example at extraction_directory/source_package_adas_opencv_algorithms/apps/adas/adas_algo_plugins.