Why are the min and max vectors for pcl::CropBox 4-dimensional?

Viewed 1144

The setMin and setMax methods of the pcl::CropBox filter each take an Eigen::Vector4f as a parameter.

Why 4f and not 3f? What's the fourth dimension for?

1 Answers

What's the Vector4F for?

The Vector4f corresponds to the homogeneous coordinate. For example, (3, 4, 5, 1) and (6, 8, 10, 2) is the same point in homogeneous coordinates system. You can normalize(a, b, c, d) to (a/d, b/d, c/d, 1) in this case.

Easy answer is: Just set the last digit to 1

Why PCL CropBox needs Vector4f?

It's because PCL CropBox can handle any box transformation via setTransform

Transformation matrix usually contains a 4x4 matrix, example shown below where r is a 3x3 rotation matrix and t is a 3-d vector

[[r0, r1, r2, t0],
 [r3, r4, r5, t1],
 [r6, r7, r8, t2],
 [ 0,  0,  0,  1]]

It's just easier to matrix multiply a homogeneous coordinate (1x4) vector with (4x4) matrix.

Feel free to ask more question, as I can update this answer.

Related