Clustering data in C ++ using openGL

I am working on a project for tracking objects, where I get data (distance in mm and amplitude) from the Lidar sensor (Pepperl-Fuchs R2000). Using OpenGL and C ++, I display data in a Linux machine.
enter image description here Now I want to group points in clusters based on distance. I do not know how to put all clusters in separate containers in C ++? Is it likely that I can use the output from OpenGL as input to OpenCV to track objects?

+5
source share
2 answers

You must convert OpenGL data to OpenCV structures. OpenCV has built-in functions for exchanging data, see here . You can also copy OpenGL points into an OpenCV Mat or an OpenCV vector cv::Point3f . How to do this depends on the OpenGL structure in which your points are represented. If you need to convert matrices from OpenGL to OpenCV, keep in mind that OpenGL stores matrices in the main column order, whereas OpenCV does row ordering.

OpenCV then provides some (limited) cluster solutions . Depending on your application, k-tools may work, but I would suggest you also look at other clustering methods such as QuickShift or DBSCAN.

+5
source

You can easily map all this data in OpenCV using Map (or [Point_] or [KeyPoint] according to your use 2 ).
After that, I would suggest using DBSCAN because it works on a density basis and does not need the number of clusters (because I don’t think you can pre-determine the number of clusters here), like K-Means.

Note. . You can easily find C ++ code for DBSCAN on the Internet.

+1
source

All Articles