Ask Your Question

Revision history [back]

Appropriate data format for 3D transformations.

I need to do various calculations between different coordinate systems, translation, rotation, projection to 2D in pixels, etc. It is necessary to define 3D and 2D points and 3x3 matrices of float. Which formats would you recommend for easy multiplication of 3 dimensional vector by 3x3 matrix? The options are Mat, Matx, Vec, Point, Point3, vector. It seems that not all of them can participate in matrix expressions.

Appropriate data format for 3D transformations.

I need to do various calculations between different coordinate systems, translation, rotation, projection to 2D in pixels, etc. It is necessary to define 3D and 2D points and 3x3 matrices of float. Which formats would you recommend for easy multiplication of 3 dimensional vector by 3x3 matrix? The options are Mat, Matx, Vec, Point, Point3, vector. It seems that not all of them can participate in matrix expressions.expressions. I guessed that the best way is to represent object points as Point3f ObjPt, screen projection as Point2i aka Point and rotation matrix as Mat R(3, 3, CV_32FC1, 0.0f), but then I can't do ObjPt * R.

Appropriate data format for 3D transformations.

I need to do various calculations between different coordinate systems, translation, rotation, projection to 2D in pixels, etc. It is necessary to define 3D and 2D points and 3x3 matrices of float. Which formats would you recommend for easy multiplication of 3 dimensional vector by 3x3 matrix? The options are Mat, Matx, Vec, Point, Point3, vector. It seems that not all of them can participate in matrix expressions. I guessed that the best way is to represent object points as Point3f ObjPt, screen projection as Point2i aka Point and rotation matrix as Mat R(3, 3, CV_32FC1, 0.0f), but then I can't do ObjPt * R.R. It is impossible to multiply native C++ vector by 3x3 Mat. I also can't multiply Matx31f by Matx33f (OpenCV 2.4.13.2). All the other types are derived from Matx. Hence, the only option available - to keep everything (transformation matrix, input and output points) as Mat.