|
| 1 | +# DBScan-PCL-Optimized |
| 2 | + |
| 3 | +This project is taken from: **Navarro-Hinojosa, Octavio, y Moisés Alencastre-Miranda. "DBSCAN modificado con Octrees para agrupar nubes de puntos en tiempo real." Research in Computing Science, Vol. 114: Advances in Image Processing and Computer Vision, pp. 173–186, 2016.** Github: https://github.com/Hagen23/DBScan_Octrees |
| 4 | + |
| 5 | +It was modified with: |
| 6 | + |
| 7 | +* It was added a CMakeList.txt for cmake compilation with PCL 1.8.1 (support 1.9.1) |
| 8 | +* It was added an argument param options |
| 9 | +* It was added a pcl visualizer |
| 10 | +* It was deleted the Glut visualizer |
| 11 | +* It was added a cluster saving method |
| 12 | +* It was added a cluster coloring method |
| 13 | +* It was replaced the input file from CSV to PCD |
| 14 | +* It was added a cluster coloring method for original color of the point cloud |
| 15 | + |
| 16 | +## Input file structure support |
| 17 | + |
| 18 | +* .pcd |
| 19 | +* .ply |
| 20 | +* .txt |
| 21 | +* .xyz |
| 22 | + |
| 23 | +## Output file structure (default = .pcd) |
| 24 | +* cloud_cluster_#.txt: |
| 25 | + |
| 26 | + x y z r g b |
| 27 | + |
| 28 | +## Example |
| 29 | +<img src="./example/scan1.png" align="center" height="400" width="720"><br> |
| 30 | +<img src="./example/example2.png" align="center" height="400" width="720"><br> |
| 31 | + |
| 32 | +------------------- |
| 33 | +## Compilation |
| 34 | +* Set "YOUR OWN" PCL Build DIR in CMakeList.txt e.g: **/opt/pcl-1.8.1/build** and save it. |
| 35 | +* Create a "build" folder |
| 36 | + |
| 37 | +in the main folder: |
| 38 | + |
| 39 | + - cd build/ |
| 40 | + - cmake ../ |
| 41 | + - make |
| 42 | + |
| 43 | + |
| 44 | +### Test |
| 45 | + |
| 46 | + cd build/bin |
| 47 | + ./dbscan <input file> <-- This will run a fast testing with default parameters |
| 48 | + ./dbscan <input file> <octree resolution> <eps> <min Aux Pts> <min Pts> <output dir> <output extension (optional)> |
| 49 | + |
| 50 | + input file = path to input point_cloud (.pcd .txt .ply .xyz) |
| 51 | + octree resolution = 124 |
| 52 | + eps = 40 |
| 53 | + min Pts = 4 |
| 54 | + max Pts = 5 |
| 55 | + output dir = path to output clusters |
| 56 | + output extension (optional) = pcd, ply, txt or xyz |
| 57 | + |
| 58 | + Example: |
| 59 | + ./dbscan /home/xXx/Downloads/point_cloud.pcd 124 40 5 5 /home/xXx/Downloads/clusters ply |
| 60 | + |
| 61 | + ¡You can modify the parameters to obtain better results! |
| 62 | + I recommend modifying only the eps value, with 40 - 60 you can get better clusters. |
| 63 | + |
| 64 | +## Note |
| 65 | + |
| 66 | +If you do not want to see the output clusters on PCL Viewer, set: |
| 67 | + |
| 68 | + bool showClusters = False; //Main function |
| 69 | + |
| 70 | +## Troubleshoot PCL-1.9.1 |
| 71 | +if compiling the project with PCL-1.9.1 this occurs: |
| 72 | + |
| 73 | + -- Build files have been written to: /home/t00215031/Downloads/DBScan-PCL-Optimized-master/build |
| 74 | + [ 20%] Building CXX object CMakeFiles/dbscan.dir/main.cpp.o |
| 75 | + In file included from /opt/pcl-1.9.1/common/include/pcl/pcl_macros.h:75:0, |
| 76 | + from /opt/pcl-1.9.1/octree/include/pcl/octree/octree_nodes.h:47, |
| 77 | + . |
| 78 | + . |
| 79 | + . |
| 80 | + |
| 81 | + /opt/pcl-1.9.1/build/include/pcl/pcl_config.h:7:4: error: #error PCL requires C++14 or above |
| 82 | + #error PCL requires C++14 or above |
| 83 | + ^ |
| 84 | + CMakeFiles/dbscan.dir/build.make:62: recipe for target 'CMakeFiles/dbscan.dir/main.cpp.o' failed |
| 85 | + make[2]: *** [CMakeFiles/dbscan.dir/main.cpp.o] Error 1 |
| 86 | + CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/dbscan.dir/all' failed |
| 87 | + make[1]: *** [CMakeFiles/dbscan.dir/all] Error 2 |
| 88 | + Makefile:83: recipe for target 'all' failed |
| 89 | + make: *** [all] Error 2 |
| 90 | + |
| 91 | + ## Solution |
| 92 | + 1. Update gcc and g++ to version 6: |
| 93 | + $ sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test |
| 94 | + $ sudo apt-get update -y |
| 95 | + $ sudo apt-get install -y gcc-6 g++-6 clang-3.8 |
| 96 | + $ sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-6 70 --slave /usr/bin/g++ g++ /usr/bin/g++-6 |
| 97 | + |
| 98 | + --> check gcc and g++ version: |
| 99 | + $ gcc --version |
| 100 | + $ g++ --version |
| 101 | + |
| 102 | + g++ (Ubuntu 6.5.0-2ubuntu1~16.04) 6.5.0 20181026 |
| 103 | + Copyright (C) 2017 Free Software Foundation, Inc. |
| 104 | + This is free software; see the source for copying conditions. There is NO |
| 105 | + warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
| 106 | + |
| 107 | + 2. Compile again |
| 108 | + $ cmake../ && make |
| 109 | + |
| 110 | +if: |
| 111 | + |
| 112 | + ../../../bin/librtabmap_core.so.0.11.11: undefined reference to `pcl::search::Search<pcl::PointXYZRGBNormal>::getName[abi:cxx11]() const' |
| 113 | + ../../../bin/librtabmap_core.so.0.11.11: undefined reference to `pcl::search::Search<pcl::PointXYZRGB>::getName[abi:cxx11]() const' |
| 114 | + ../../../bin/librtabmap_core.so.0.11.11: undefined reference to `pcl::search::Search<pcl::PointXYZ>::getName[abi:cxx11]() const' |
| 115 | + collect2: error: ld returned 1 exit status |
| 116 | + |
| 117 | + Solution: |
| 118 | + |
| 119 | + #include <pcl/search/impl/search.hpp> |
| 120 | + |
| 121 | + #ifndef PCL_NO_PRECOMPILE |
| 122 | + #include <pcl/impl/instantiate.hpp> |
| 123 | + #include <pcl/point_types.h> |
| 124 | + PCL_INSTANTIATE(Search, PCL_POINT_TYPES) |
| 125 | + #endif // PCL_NO_PRECOMPILE |
| 126 | + |
| 127 | + |
| 128 | + |
| 129 | + |
| 130 | + |
| 131 | + |
| 132 | + |
| 133 | + |
| 134 | + |
| 135 | + |
| 136 | + |
| 137 | + |
| 138 | + |
0 commit comments