alejocb / dpptam

DPPTAM: Dense Piecewise Planar Tracking and Mapping from a Monocular Sequence
GNU General Public License v3.0
219 stars 82 forks source link

Distance calculation in "distances_interval" function #15

Closed sunghoon031 closed 8 years ago

sunghoon031 commented 8 years ago

I am suspecting that the following calculation is wrong in distances_interval function in DenseMapping.cpp:

float distance = fabs(real_points_in_image.at<float>(ii,0)-C.at<float>(0,0))
+fabs(real_points_in_image.at<float>(ii,1)-C.at<float>(0,1))
+fabs(real_points_in_image.at<float>(ii,2)-C.at<float>(0,2));

The reason is that real_points_in_image is the position vector wrt world frame, and C is the translational vector from camera to world. I think the correct computation should simply be

float distance = fabs(real_points_in_image.at<float>(ii,0)-t_.at<float>(0,0))
+fabs(real_points_in_image.at<float>(ii,1)-t_.at<float>(1,0))
+fabs(real_points_in_image.at<float>(ii,2)-t_.at<float>(2,0));

t_ has the same magnitude as C but just an opposite sign (and transpose). The code runs without an error , but the dense mapping doesn't work so well...

sunghoon031 commented 8 years ago

Actually never mind. Since we're considering the camera pose wrt world, it is correct to use C.