Code Monkey home page Code Monkey logo

libicp's Introduction

####################################################################################
# Copyright 2011. All rights reserved.                                             #
# Institute of Measurement and Control Systems                                     #
# Karlsruhe Institute of Technology, Germany                                       #
#                                                                                  #
# This file is part of libicp.                                                     #
# Authors:  Andreas Geiger                                                         #
#           Please send any bugreports to [email protected]                           #
#                                                                                  #
# libicp is free software; you can redistribute it and/or modify it under the      #
# terms of the GNU General Public License as published by the Free Software        #
# Foundation; either version 3 of the License, or any later version.               #
#                                                                                  #
# libicp is distributed in the hope that it will be useful, but WITHOUT ANY        #
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A  #
# PARTICULAR PURPOSE. See the GNU General Public License for more details.         #
#                                                                                  #
# You should have received a copy of the GNU General Public License along with     #
# libicp; if not, write to the Free Software Foundation, Inc., 51 Franklin         #
# Street, Fifth Floor, Boston, MA 02110-1301, USA                                  #
####################################################################################

+++++++++++++++++++++++++++++++++++
+          INTRODUCTION           +
+++++++++++++++++++++++++++++++++++

Libicp (LIBrary for Iterative Closest Point fitting) is a cross-platfrom C++
library with MATLAB wrappers for fitting 2d or 3d point clouds with respect to
each other. Currently it implements the SVD-based point-to-point algorithm as well
as the linearized point-to-plane algorithm. It also supports outlier rejection
and is accelerated by the use of kd trees as well as a coarse matching stage
using only a subset of all points.

If you distribute a software that uses libicp, you have to distribute it under GPL
with the source code.

+++++++++++++++++++++++++++++++++++
+    COMPILING MATLAB WRAPPERS    +
+++++++++++++++++++++++++++++++++++

If you want to use libicp directly from MATLAB you can easily do this by using
the MATLAB wrappers provided. They also include some demo files for testing your
configuration. First, configure your MATLAB MEX C++ compiler, if it is not yet
configured (mex -setup). Under Linux you might use g++, under Windows I compiled
it successfully with the Microsoft Visual Studio Express 2008 compilers.

1) Change to the libicp/matlab directory
2) After running 'make.m' you should have a MEX file called 'icpMex'
3) Now try to run 'demo_2d.m' or 'demo_3d.m'

+++++++++++++++++++++++++++++++++++
+     BUILDING A C++ LIBRARY      +
+++++++++++++++++++++++++++++++++++

Prerequisites needed for compiling libicp using c++:
- CMake (available at: http://www.cmake.org/)
- Boost (available at: http://www.boost.org/)

Note:

Please make sure that the boost headers can be found!
(Add /usr/local/include to your include path if you have
installed them locally)

Linux:

1) Move to libicp root directory
2) Type 'cmake .'
3) Type 'make'
4) Run './icp' (demo program)

Windows:

1) Start CMake GUI
2) Set directories to libicp root directory
3) Run configure, configure and generate
4) Open the resulting Visual Studio solution with Visual Studio
5) Switch to 'Release' mode, build all and run the demo program

For more information on CMake, have a look at the CMake documentation.

For more information on the usage of the library, have a look into the MATLAB wrappers and
into the documentation of the header file icp.h.

Please send any feedback and bugreports to [email protected]
Andreas Geiger

libicp's People

Contributors

symao avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

libicp's Issues

how to get correspondences p_m and p_t?

#pragma omp parallel for private(i) default(none) shared(T,active,nact,p_m,p_t,r00,r01,r10,r11,t0,t1) reduction(+:mum0,mum1, mut0,mut1) // schedule (dynamic,2)

how to get correspondences p_m and p_t?
if M and T do not have the same point numbers,is it still work?

Why do we get this result on a small data set ?

i have a model with 9 points :

[ first model ]

point [1] = -0.7274105,0.4433649,0.3854795

point [2] = -0.6887414,0.468136,0.3351357

point [3] = -0.6507958,0.4968288,0.3064253

point [4] = -0.608408,0.5224559,0.2845465

point [5] = -0.5705151,0.5428149,0.2762859

point [6] = -0.5200281,0.530516,0.290995

point [7] = -0.4738899,0.517576,0.3070973

point [8] = -0.4077983,0.4964231,0.3430573

point [9] = -0.374032,0.4680868,0.3830469

[ Second model ]

point [1] = -0.2999626,-0.1806934,-0.1651699

point [2] = -0.2616181,-0.169532,-0.2044329

point [3] = -0.2160359,-0.1454861,-0.2266136

point [4] = -0.1741856,-0.1275599,-0.2524842

point [5] = -0.1191077,-0.105789,-0.251252

point [6] = -0.05154949,-0.12353,-0.2471861

point [7] = -0.006585903,-0.14095,-0.2418299

point [8] = 0.03595421,-0.1584896,-0.2201264

point [9] = 0.08099623,-0.1683025,-0.189768

we got this result :
Transformation results:
R:
-0.0280522 -0.6967893 0.7167271
0.6285203 0.5452465 0.5546787
-0.7772871 0.4660376 0.4226508

t:
16.1951564
3.4604233
-1.0535334

Why do we got this result, because after we apply it to the models, we still not have accurate matching

Fail case with some point clouds

Hi, I'm attempting to use this library to align some point clouds. On some clouds, for reasons I've yet to identify, I'm getting crashes in the build_tree_for_Range function, particularly in

` int c = -1;
float maxspread = 0.0;
int m;

  for (int i=0;i<dim;i++) {
    if ((parent == NULL) || (parent->cut_dim == i)) {
      spread_in_coordinate(i, l, u, node->box[i]);
    } else {
      node->box[i] = parent->box[i];
    }
    float spread = node->box[i].upper - node->box[i].lower;
    if (spread>maxspread) {
      maxspread = spread;
      c=i;
    }
  }`

where spread>maxspread never hits, and the array tries to index c=-1, which crashes.

Rotation and Translation are identity and 0 always

Hi,

I was using the point to plane ICP on 2D data. While the results are correct when I use Eigen::umeyama(), the results I get when I run the IcpPointToPlane gives
Transformation results:
R:
1.0000000 0.0000000 0.0000000
0.0000000 1.0000000 0.0000000
0.0000000 0.0000000 1.0000000

t:
0.0000000
0.0000000
0.0000000

I am testing it with a simple function y = x² + c on 50 points and 1000 points.
I just changed the demo.cpp as follows

int32_t dim = 2;
int32_t num = 1000;

// allocate model and template memory
double* M = (double*)calloc(dimnum,sizeof(double));
double
T = (double*)calloc(dim*num,sizeof(double));

// set model and template points
cout << endl << "Creating model with 10000 points ..." << endl;
cout << "Creating template by shifting model by (1,0.5,-1) ..." << endl;
int32_t k=0;

for(int i=0; i<num; i++){
M[k * dim+0] = i;
M[k * dim+1] = std::pow(i,2);
T[k * dim+0] = i;
T[k * dim+1] = std::pow(i,2)+10;
k++;
}

// start with identity as initial transformation
// in practice you might want to use some kind of prediction here
Matrix R = Matrix::eye(dim);
Matrix t(dim,1);

// run point-to-plane ICP (-1 = no outlier threshold)
cout << endl << "Running ICP (point-to-plane, no outliers)" << endl;
IcpPointToPlane icp(M,num,dim);
double residual = icp.fit(T,num,R,t,-1);

I am not sure what I am missing. Eigen::umeyama() gives the correct translation of (0,10) for the 2 curves.

Thanks!

Error with large arrays

I tried with small arrays, it worked but it raised error with the larger ones.

The error was as following:

Running ICP (point-to-plane, no outliers)
openGLScratch: /mnt/linuxdisk/localdev/boost_1_76_0/build/include/boost/multi_array/base.hpp:177: Reference boost::detail::multi_array::value_accessor_one<T>::access(boost::type<Reference>, boost::detail::multi_array::value_accessor_one<T>::index, TPtr, const size_type*, const index*, const index*) const [with Reference = const float&; TPtr = const float*; T = float; boost::detail::multi_array::value_accessor_one<T>::index = long int; boost::detail::multi_array::multi_array_base::size_type = long unsigned int]: Assertion `idx - index_bases[0] >= 0' failed.
Aborted (core dumped)

I traced down to the code in kdtree.cpp:185

            sum += the_data[ind[k]][c];

Here are the point cloud files

https://www.dropbox.com/sh/7ov8hf5dp45d42r/AACDvZlPWiziFxkkSjmEZdpJa?dl=0

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.