meiqua / pose_refine

cuda icp for 6D pose estimation
BSD 2-Clause "Simplified" License
96 stars 25 forks source link

Got wrong Result #3

Closed doublexxking closed 5 years ago

doublexxking commented 5 years ago

Hi. I used your code to implement my own data. I use PCL to read two point cloud from PCD files, one is Scene_nn scene; KDTree_cpu kdtree_cpu; scene.init_Scene_nn_cpu();

I also find normals from PCL and init KDTree in cup and push to GPU as init_Scene_nn_cuda does.

The other one is used by thrust::copy to get a device vector.

However, when I use cuda_icp::ICP_P2P_cuda to get results, I find the first iteration works fine, but it gives a crazy extrinsic (variable in ICP_P2P_cuda funtion). Thus, the second iteration cannot find a reasonable results and Ab[28] is 0 to return the function. The final result is the crazy extrinsic in first iteration.

I am not sure why it give me this results and I use your data works very good.

It is appreciate that you could give me some hints.

Thanks in advance.

meiqua commented 5 years ago

Are the point clouds roughly aligned initially? You can check this by visualizing them in open3d.

doublexxking commented 5 years ago

The point clouds is aligned. The PCL can give me correct results. And it is why the first iteration works fine but the second iteration always wrong.

meiqua commented 5 years ago

How does open3d's icp work like here?

doublexxking commented 5 years ago

I do not compile open3d but I change all to PCL to visualize the point cloud and check my results. After PCL, the two point clouds aligned very well..

meiqua commented 5 years ago

what's the fitness after the first iteration?

doublexxking commented 5 years ago

*first*** count: 1076.000000 fitness: 1.000000 inlier rmse : 4.325136

*second*** count: 698.000000 fitness: 0.648699 inlier rmse : 78.470566

*third*** count: 0.000000

My model is in mm, so I set max_dist_diff = 100.0f;

doublexxking commented 5 years ago

Screenshot from 2019-08-13 10-40-41 Screenshot from 2019-08-13 10-41-53

I also attached two images, first one is before the ICP and the scond one is after the ICP

meiqua commented 5 years ago

Can you paste some relevant codes? The bug is in the initial function of clouds and normals maybe.

doublexxking commented 5 years ago

After your hints, I find I actually got wrong normals. Thanks!!!

aditya2592 commented 4 years ago

Hi @double344931987 . Do you have any sample code to run the ICP between a depth image form cuda_renderer in the repo and a random scene or between two random point clouds?

aditya2592 commented 4 years ago

@meiqua In the get_normal() function in common.cpp, what units are following in and what do they signify :

 int distance_threshold = 2000;
 int difference_threshold = 5
meiqua commented 4 years ago

Units: mm. distance_threshold: if depth is greater than this, normals are not calculated. difference_threshold: in the sliding window, if depth - center depth > threshold, depth at this pixel will not be considered for normal.