Transform point cloud's coordinates to another coordinates in Point Cloud Library, which makes the ground plane as the X-O-Y plane?

拥有回忆 提交于 2019-12-20 04:17:21

问题


I have a point cloud from kinect fusion and use Point Cloud Library to segment the ground plane(ax+by+c*z+d=0) successfully(I got the a,b,c,d in pcl::ModelCoefficients of the ground plane). Now I need to transform the Cartesian coordinates to new Cartesian coordinates that makes the ground plane became the X-O-Y plane(0*x+0*y+z=0). I guess I can do it by this API(but I don't know how): http://docs.pointclouds.org/trunk/group__common.html#transformPointCloud

My Answer: Look at this PCL api:http://docs.pointclouds.org/1.7.2/a02405.html#ga4375e99ec2ae368eec9379f506568611

I successfully solved this problem!


回答1:


I can't open the link to your API but guess you can transform you plane using simple transformations:

  1. you should add to all your points vector {a * d, b * d, c * d} - that moves your points to plane ax + by + cz = 0
  2. then you should find rotation matrix around axis [{a, b, c} cross {0, 0, 1}] on angle [{a, b, c} dot {0, 0, 1}] and transform your points by this matrix http://www.euclideanspace.com/maths/geometry/rotations/conversions/angleToMatrix- here you can see how to find the rotation matrix from axis and angle



回答2:


This function requires camera pose, which is a 4x4 matrix, of the form

| R   t |
| 0   1 |

Here, R is 3x3 rotation matrix, t is a 3x1 translation vector, 0 - is a 1x3 vector of zeros, and 1 is a unity (scalar).

You should design this matrix in such a way, that Z axis in a new coordinate system will be collinear to the normal vector of your plane. New X and Y axes are arbitrary, the only restriction is that they must form orthogonal basis.

This link explains how to derive matrix R.



来源:https://stackoverflow.com/questions/29841323/transform-point-clouds-coordinates-to-another-coordinates-in-point-cloud-librar

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!