Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 231
Harsh Patel Avatar asked Sep 27 '16 09:09

Harsh Patel


2 Answers

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.

like image 199
ChronoTrigger Avatar answered Sep 30 '22 13:09

ChronoTrigger


You can easily map all those data in OpenCV using Map (or [Point_] or [KeyPoint] according to your use 2) function.
After that I would suggest to use DBSCAN because it works based on density and doesn't need number of cluster (because I don't think you can pre-defined number of cluster here) like K-Means.

Note: You may easily find c++ code for DBSCAN on internet.

like image 33
Always Minus Avatar answered Sep 30 '22 15:09

Always Minus