Question

I have a point cloud of a depth image that was taken with the camera 30 degrees above the horizontal (rotated 30 degrees in z-axis). I want to translate all of the points back to their position as if the camera was at 0 degrees, which I believe I can do with the following rotation matrix:

|cos(30) -sin(30) 0| 
|sin(30)  cos30   0| 
|0        0       1|

However, when looking at the pcl method to transform a point cloud I found this:

pcl::transformPointCloud (const PointCloud< PointT > &cloud_in, 
PointCloud< PointT > &cloud_out, const Eigen::Matrix< Scalar, 4, 4 > &transform)

But why is it a 4x4 matrix as opposed to the 3x3 rotation one above?

Was it helpful?

Solution

|x||1 0 0 a| =  |x+a|
|y||0 1 0 b|    |y+b|
|z||0 0 1 c|    |z+c|
|1||0 0 0 1|    |1  |

In this example we moved the point (x,y,z) to the point(x+a, y+b, z+c). This can only be done with a 4 x 4 matrix.


|cos(30) -sin(30) 0 0| multiply The Matrix above. 
|sin(30)  cos30   0 0| 
|0        0       1 0|
|0        0       0 1|

This will give you a rotation and translation of a point.

OTHER TIPS

The 4x4 Matrix is a Transformation matrix in the following form

| R    | t | 
|--------- |
|0 0 0 | 1 |

where R is your 3x3 rotation matrix and t is a 3x1 translation vector. In your case t = [0,0,0]'

For more info: http://en.wikipedia.org/wiki/Transformation_matrix

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top