|
1 | 1 | # pICP
|
2 |
| -This project provides a clean and fast implementation of the ICP method by [Besl and McKay](https://ieeexplore.ieee.org/document/121791/) in C++ with minimal dependencies ([Eigen](http://eigen.tuxfamily.org) for matrix manipulation and SVD computation, and [Nanoflann](https://github.com/jlblancoc/nanoflann) for KDTree-based correspondences search). The algorithm is one of the baseline methods on rigid alignment of point clouds, and this implementation attempts to provide an entry point for learning it with no practical hassles. At the same time, it works fast and robustly enough to be used out-of-the box on any of your projects. |
| 2 | +This project provides a clean and fast implementation of the ICP method by [Besl and McKay](https://ieeexplore.ieee.org/document/121791/) in C++ with minimal dependencies (see below). The algorithm is one of the baseline methods on rigid alignment of point clouds, and this implementation attempts to provide an entry point for learning it with no practical hassles. At the same time, it works fast and robustly enough to be used out-of-the box on any of your projects. |
3 | 3 |
|
4 |
| - |
| 4 | + |
5 | 5 |
|
6 | 6 |
|
7 | 7 | ## How it works
|
8 | 8 | ### The problem
|
9 | 9 | Given two point sets:
|
10 | 10 |
|
11 |
| - |
| 11 | + |
12 | 12 |
|
13 |
| - |
| 13 | + |
14 | 14 |
|
15 | 15 | find a rotation R and translation T that minimizes the error:
|
16 | 16 |
|
17 |
| - |
| 17 | + |
18 | 18 |
|
19 | 19 | ### SVD based transform estimation
|
20 | 20 | Given a matrix W made by a set of correspondent N points, centered to its mean
|
21 | 21 |
|
22 |
| - |
| 22 | + |
23 | 23 |
|
24 | 24 | obtain the Singular Value Decomposition of W = U * S * Vt.
|
25 | 25 |
|
26 | 26 | Theorem without proof says that if rank( W ) = 3, the optimal solution of E( R, t ) is unique and given by:
|
27 | 27 |
|
28 |
| - |
| 28 | + |
29 | 29 |
|
30 |
| - |
| 30 | + |
31 | 31 |
|
32 | 32 | This process can be run iteratively, selecting correspondent points by different criteria (neighbourhood, random search...), until convergence.
|
33 | 33 |
|
34 | 34 | ## Dependencies
|
35 |
| -[Eigen](http://eigen.tuxfamily.org) is the only external dependency required on your system. [Nanoflann](https://github.com/jlblancoc/nanoflann) is included in the project. |
| 35 | +This project attempts to use the minimal dependencies as possible, and those are self-contained in the project when possible. |
36 | 36 |
|
37 |
| -A real test executable is provided, allowing to register any desired pair of point clouds (only .obj format supported at the moment). The PointCloud class uses [TinyObjLoader](https://github.com/syoyo/tinyobjloader) (header included) for parsing OBJ files, and the PlainICP executable requires [Boost](https://www.boost.org/) for parsing external arguments. |
| 37 | +* [Nanoflann](https://github.com/jlblancoc/nanoflann) for KDTree-based correspondences search. Self-contained. |
| 38 | +* [TinyObjLoader](https://github.com/syoyo/tinyobjloader) for OBJ file parsing. Self-contained. |
| 39 | +* [googletest](https://github.com/google/googletest) for Unit testing. Self-contained (downloads and installs automatically). |
| 40 | +* [Eigen](http://eigen.tuxfamily.org) for matrix manipulation and SVD computation. Required on your system. |
| 41 | +* [Boost](https://www.boost.org/) just for parsing command-line arguments into the PlainICP executable. Required on your system. |
38 | 42 |
|
39 | 43 | ## Usage
|
40 |
| -Just include the ICP class header on your project. |
41 |
| - |
42 |
| -Check the provided cmake project for compiling an executable which shows how to use the class: |
| 44 | +Make sure Eigen and Boost are installed on your system and compile the full project: |
43 | 45 |
|
44 | 46 | ```
|
| 47 | +sudo brew install eigen boost # For OsX |
| 48 | +sudo apt-get install libeigen3-dev libboost-all-dev # For Linux apt based distros |
| 49 | +
|
45 | 50 | mkdir ./build
|
46 | 51 | cd ./build
|
47 | 52 | cmake ..
|
|
51 | 56 | Sample call with provided sample OBJ files:
|
52 | 57 |
|
53 | 58 | ```
|
54 |
| -./PlainICP --source-obj-file ../samples/bunny_head.obj --target-obj-file ../samples/bunny.obj --transformed-obj-file ../samples/aligned_bunny_head.obj --tolerance 0.0005 --verbose 1 |
| 59 | +./PlainICP --source-obj-file ../test/data/bunny_head.obj \ |
| 60 | + --target-obj-file ../test/data/bunny.obj \ |
| 61 | + --transformed-obj-file ../test/data/aligned_bunny_head.obj \ |
| 62 | + --tolerance 0.005 \ |
| 63 | + --verbose 1 |
55 | 64 | ```
|
56 | 65 |
|
| 66 | +If you want to integrate the ICP implementation into your project, just copy the headers into your source code. |
| 67 | + |
57 | 68 | ## Testing
|
58 |
| -Unit testing using [googletest](https://github.com/google/googletest) is provided (Google Test dependency is automatically installed and self-contained within the project). Run the following target in the build directory: |
| 69 | +Unit testing is provided. Run the following target in the build directory: |
59 | 70 |
|
60 | 71 | ```
|
61 | 72 | make build_and_test
|
62 | 73 | ```
|
63 | 74 |
|
64 | 75 | ## License
|
65 |
| -This software release is primarily [MIT](https://opensource.org/licenses/MIT) licensed. Some files contain third-party code under other licens |
| 76 | +This software release is primarily [MIT](https://opensource.org/licenses/MIT) licensed. Some files contain third-party code under other license. |
0 commit comments