问题
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:
- you should add to all your points vector {a * d, b * d, c * d} - that moves your points to plane ax + by + cz = 0
- 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