Fri*_*edi 6 python opencv orientation marker aruco
I want to use ArUco to find the "space coordinates" of a marker.
I have problems understanding the tvecs and rvecs. I came so far as to the tvecs are the translation and the rvecs are for rotation. But how are they oriented, in which order are they written in the code, or how do I orient them?
Here is a little sketch of the setup. I have a camera (laptop webcam just drawn to illustrate the orientation of the camera) at the position X,Y,Z, the Camera is oriented, which can be described with angle a around X, angle b around Y, angle c around Z (angles in Rad).
So if my camera is stationary I would take different pictures of the ChArUco Boards and give the camera calibration algorithm the tvecs_camerapos (Z,Y,X) and the rvecs_camerapos (c,b,a). I get the cameraMatrix, distCoeffs and tvecs_cameracalib, rvecs_cameracalib. t/rvecs_camerapos and t/rvecs_cameracalib are different which I find weird.
camerapos or cameracalib for pose estimation if the camera does not move? I think t/rvecs_cameracalib is negligible because I am only interested in the intrinsic parameters of the camera calibration algorithm.
现在我想找到标记的X、Y、Z位置,我使用aruco.estimatePoseSingleMarkerswitht/rvecs_camerapos和 retrive t/rvecs_markerpos。将tvecs_markerpos不符合我的预期值。
t/rvecs_markerpos才能找到标记的X、Y、Z?处理相机和相机校准(包括 AruCo)的 OpenCV 例程使用针孔相机模型。世界原点定义为相机模型的投影中心(进入相机的所有光线会聚于此),Z轴定义为相机模型的光轴,X轴和Y轴形成正交系统Z。+Z在相机前面,+X在右边,+Y在下。所有 AruCo 坐标均在此坐标系中定义。这解释了为什么您的“相机” tvecs 和 rvecs 会发生变化:它们没有定义您的相机在某些世界坐标系中的位置,而是相对于您的相机的标记位置。
你真的不需要知道相机校准算法是如何工作的,除了它会给你一个相机矩阵和一些镜头失真参数,你可以将它们用作其他 AruCo 和 OpenCV 例程的输入。
获得校准数据后,您可以使用 AruCo 识别标记并返回它们在相机定义的 3D 坐标系中的位置和方向,并正确补偿相机镜头的失真。这足以完成,例如,在来自相机的视频馈送之上使用 OpenGL 的增强现实。
标记的 tvec 是标记从原点的平移 (x,y,z);距离单位是您用来定义打印校准图的任何单位(即,如果您使用 mm 将校准图描述给 OpenCV,则 tvecs 中的距离单位为 mm)。
标记的 rvec 是一个 3D 旋转矢量,它定义了旋转轴和围绕该轴的旋转角度,并给出了标记的方向。可以使用 Rodrigues 函数 (cv::Rodrigues()) 将其转换为 3x3 旋转矩阵。要么是将标记的局部轴转换为世界(相机)轴的旋转,要么是相反的 - 我不记得了,但您可以轻松检查。
| 归档时间: |
|
| 查看次数: |
3941 次 |
| 最近记录: |