Harsh Patel Harsh Patel - 4 months ago 43
C++ Question

Data clustering in C++ using openGL

I am working on a project for object tracking, where I am getting data (distance in mm and amplitude) from a Lidar sensor(Pepperl-Fuchs R2000).
Using OpenGL and C++ I am displaying data in linux machine.

enter image description here
Now I want to group the points in clusters based on distance.
I don't know how to put all the clusters in separate containers in c++?
Is there any possibility that I can use output data from OpenGL as an input data in OpenCV for object tracking?


You should transform the OpenGL data into OpenCV structures. There are some built-in functions in OpenCV to share data, look here. You also may copy the OpenGL points into a OpenCV Mat, or a vector of OpenCV cv::Point3f. How to do it depends on the OpenGL structure your points are represented in. If you have to convert matrices from OpenGL into OpenCV, take into account that OpenGL stores matrices in column-major order, whereas OpenCV does row-major order.

Then, OpenCV provides some (limited) clustering solutions. Depending on your application, k-means may work, but I'd suggest you also look at other clustering techniques, such as QuickShift or DBSCAN.