praveen-palanisamy / multiple-object-tracking-lidar

C++ implementation to Detect, track and classify multiple objects using LIDAR scans or point cloud
MIT License
787 stars 229 forks source link

Unsupervised k-means #21

Closed tberriel closed 4 years ago

tberriel commented 4 years ago

Hello, I am interested on the unsupervised k-means clustering, but I can't get to find where you are using it. I've explored the code and observed that the main.cpp uses only the Kd-tree search and Kalman filter, but there isn't a single call to a kmeans function. Also it looks like featureDetection.cpp is for image processing and not for point clouds.

Where can i find the unsupervised kmeans implementation you talk about on the ReadMe?

Thank you for your help.

praveen-palanisamy commented 4 years ago

Hi @tberrielITA ,

K-means is not used in the case of 3D point clouds. The default code flow is setup for 3D point clouds and therefore k-means isn't used while the code is available in the repo (featureDetection.cpp) if someone needs to obtain similar results on a 2D input.

In the 3D point-cloud (default) case, instead of k-means, Euclidean cluster extraction is performed in these lines using PCL: https://github.com/praveen-palanisamy/multiple-object-tracking-lidar/blob/d71ff08c2eda1be00395468a4243c011d1d98729/src/main.cpp#L409-L410

Basically, after creating the Kd-tree, For every point , the following steps are performed:

  1. Add to the current queue Q;

  2. For every point Q:

    • Search for the set of point neighbors of in a sphere with radius ![]();

      • For every neighbor , check if the point has already been processed, and if not add it to Q;
    • When the list of all points in Q has been processed, add Q to the list of clusters C, and reset Q to an empty list

the algorithm terminates when all points have been processed and are now part of the list of point clusters.

Hope that helps. I will update the README to make it clear.

praveen-palanisamy commented 4 years ago

Closing this since the question was addressed. Please feel free to re-open if you have a follow-up or open a new issue.