Skip to content

Latest commit

 

History

63 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Usage of this tiny dbscan lib based on nanoflann

Massive thanks to Jose for sharing this adaptation of flann 👏🍻🍻

  • the interface
#include <vector>
#include "point.h"

namespace dbscan {

/** cluster
 *   Does density-based spatial clustering.
 *
 * @param points
 *   Un-clustered points.
 *
 * @param epsilon
 *   Epsilon hyper-parameter.
 *
 * @param minPoints
 *   Number of points in epsilon neighourhood
 *
 * @return
 *   Clustered indexes.
 */
std::vector<std::vector<unsigned long>> cluster(
std::vector<Point>& points, const float& epsilon, const int& minPoints);
}

here's an example of how to use the interface

#include <vector>
#include "dbscan.h" //<-- include dbscan library

int main(int argc, char* argv[]){

std::vector<Point> points = readPoints();

int minPoints = 4;
float epsilon = 3.320;
std::vector<std::vector<unsigned long>> iClusters = dbscan::cluster(points, epsilon, minPoints);

return 0;
}
  • You can find an example Point Class here.

  • The readPoints function can be implemented flexibly and therefore, left out.

About

DBSCAN: faster evaluation using nanoflann's kdtree

Topics

Resources

Stars

6 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages