Hello,

I believe there is an error in the PPFRegistration class, where the discretization of alpha is always done in steps of 1 radian regardless of what discretization step the user has specified. I will explain how this can be tested and hope someone can help me confirm this (or tell me that I'm completely wrong).

This is a simple addition of two terms, the first one being the floored value of alpha. Since alpha can only be in the range [-2pi, 2pi] then its floored value can only be an integer in the range [-7, 6]. The second term is the floored value of pi divided by the discretization step specified by the user. This value is a constant, since the discretization step does not change when running the method. If we call this constant 'm', it is then trivial to see that alpha_discretized will always be in the range [m-7, m+6]. In the line below (141), alpha_discretized is used as an index for the accumulator_array. Because of the problem explained above, only 14 (7+6+1) indices will be used for this array and the rest will always be 0. I do not believe this is the correct way to discretize alpha as it does not take into account the discretization step.

This also causes a segmentation fault when the user specifies discretization steps larger than pi/7. The reason for this is that the constant in line 140 will then be smaller than 7 while floor(alpha) might still be -7, thus the addition results in a number smaller than 0 which causes the unsigned int to overflow. This in turn gives a wrong index to accumulator_array in line 141 which then causes a segmentation fault. I have created a small example demonstrating the problem here:

https://github.com/Laxen/ppf_registration_bug

I think it's strange that no one has noticed this and it's making me doubt if I'm thinking correctly. Any thoughts on this would be highly appreciated!

(I'm using PCL 1.8 on Ubuntu 16.04)

_______________________________________________

[hidden email] /

http://pointclouds.orghttp://pointclouds.org/mailman/listinfo/pcl-users