How to use dwClusterer

Please provide the following info (check/uncheck the boxes after clicking “+ Create Topic”):
Software Version
DRIVE OS Linux 5.2.0
DRIVE OS Linux 5.2.0 and DriveWorks 3.5
NVIDIA DRIVE™ Software 10.0 (Linux)
NVIDIA DRIVE™ Software 9.0 (Linux)
other DRIVE OS version

Target Operating System

Hardware Platform
NVIDIA DRIVE™ AGX Xavier DevKit (E3550)
NVIDIA DRIVE™ AGX Pegasus DevKit (E3550)

SDK Manager Version

Host Machine Version
native Ubuntu 18.04

Hello Nvidia, can you provide some sample codes using Clusterer module for performing DBSCAN. I am not quite understand how to use dwClusterer_bindOutput and get invalid argument status or segfault.

Hi @v.hunglx2 ,

I’ll check if any plan of adding its sample application.
But now please give us more information about the issue, e.g. logs . Thanks.

Hi, I am trying to run this code.
Am I doing it right? Appreciate your help.

The following is the code you shared.
Please tell us which function call causes the issue and provide the log. Thanks.

// Created by hunglx on 31/03/2021.

#include <dw/Driveworks.h>
#include <dw/core/VersionCurrent.h>
#include <iostream>
#include <vector>
#include <stdlib.h>

using namespace std;

#define DW_CALL_CHECK(call) { dw_ck((call), __FILE__, __LINE__); }
inline void dw_ck(dwStatus code, const char *file, int line, bool abort=true)
  if (code != DW_SUCCESS)
    fprintf(stderr,"DW: %s %d. %d\n", file, line, code);
    if (abort)

int main() {

  dwContextHandle_t sdk = DW_NULL_HANDLE;
  dwContextParameters sdk_params = {};
  dwVersion sdkVersion;
  DW_CALL_CHECK(dwInitialize(&sdk, DW_VERSION, &sdk_params));

  dwClustererHandle_t clusterer = DW_NULL_HANDLE;
  dwClustererParams params;

  cout << params.epsilon << endl;
  cout << params.maxSampleCount << endl;
  cout << params.minSamples << endl;
  cout << params.minSumOfWeights << endl;

  DW_CALL_CHECK(dwClusterer_initialize(&clusterer, &params, sdk));

  vector<dwRectf> boxes;
  vector<float32_t> weights;

  for (int i = 0; i < 100; i++) {
    dwRectf box;
    box.x = float(rand() % 500 + 1);
    box.y = float(rand() % 500 + 1);
    box.width = float(rand() % 500 + 1);
    box.height = float(rand() % 500 + 1);

    weights.push_back(1.0f / 100);

  DW_CALL_CHECK(dwClusterer_bindInput(reinterpret_cast<const dwRectf *const *>(,
                        reinterpret_cast<const float32_t *const *>(,
                        reinterpret_cast<const uint32_t *>(boxes.size()), clusterer));

  uint32_t clusterLabelsCount;
  uint32_t clusterCount;
  int32_t *clusterLabels = nullptr;

  DW_CALL_CHECK(dwClusterer_bindOutput(&clusterLabels, &clusterLabelsCount, &clusterCount, clusterer));

  cout << "done" << endl;

Here’s the log
Segmentation fault (core dumped)

I get seg fault at line 68, function “dwClusterer_process”

I haven’t tried to reproduce the issue with your code but it may be due to you passing a nullptr clusterLabels to dwClusterer_bindOutput().

Thank you, I follow this tutorial and get it worked.
DriveWorks SDK Reference: Clusterer.
At first, i thought that Driveworks will internally allocate memory for clusterLabels binding.

1 Like