Hello,
What is the proper way to express a 3D point in one coordinate system to an other with a 3D transformation matrix in OpenCV?
I use c++ and and have my two parts of my transform matrix ( R00, T00) and few 3D points.
Is there a function which converts a vector of Point3f into an other vector of Point3f ?
if the spaces are 3D, you have points (x,y,z).
you then need to express them as (x,y,z,1), at least conceptually, and the transformation matrices need to be 4 \times 4. the extra coordinate enables translations (shift/move) because now we’re working in a “projective space”.
cv::transform
can apply a matrix to a bunch of points appropriately. if the matrix is 4x4, the points may be 3-channel or 4-channel. it’ll fill in the 1 when that is implied.
all these functions should digest vector<Point3f>
like it’s a cv::Mat
. that’s the magic of that InputArray
stuff you might have seen in the docs.
if you ever involve any kind of actual projection (unlikely if you’re just translating and rotating), you will also need convertPoints(From|To)Homogeneous
.