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

1

2

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?

Recede answered 1/4, 2020 at 17:0 Comment(0)
A
5

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.

Alacrity answered 2/4, 2020 at 4:23 Comment(6)
Great answer, thanks a lot! I guess it would be more convenient for the user if there was an overload where the method just converted a Vector3f to homogeneous coordinates internally, but this clarifies it!Recede
I just checked CropBox's source code and it does not seem to use the fourth coordinates, so it seems that it assumes normalized coordinates (i.e. fourth element equal to 1).Garbanzo
As PCL has updated the website, I think the link for setTransform needs to be updated. The updated on is this: pointclouds.org/documentation/… right?Mercier
I have other queries as well: (1) I have been trying to understand how setTransform work but so far haven't got a solid understanding. So, to confirm, when I specify setMin, setMax, by default, my cropBox would be parallelogram, right? (2) Through setRotation & setTranslate I can rotate & translate, respectively, that parallelogram w.r.t. the coordinate system of the point cloud not the coordinate system of cropBox itself, right? But even in this case my parallelogram would remain parallelogram only, right?Mercier
(3) Through setTransform can I transform my parallelogram cropBox to parallelepiped cropBox? If yes then how? (4) If yes then I have another doubt: as per the link I mentioned above, " setTransform sets a transformation that should be applied to the cloud before filtering." So, it transforms the point cloud not the cropBox, right?Mercier
If possible, could you & @GabrielDevillers please take a look at my detailed question about these confusions: https://mcmap.net/q/1482472/-how-can-i-rotate-the-pcl-cropbox-wrt-its-own-particular-axis-rather-than-global-axis-or-how-can-i-apply-affine-transform-to-pcl-cropbox/10358768Mercier

© 2022 - 2024 — McMap. All rights reserved.