Code Monkey home page Code Monkey logo

libicp's Issues

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.

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

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?

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

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!

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.