ZED双目摄像头惯导数据获取及其理解

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/Touch_Dream/article/details/84068059
sl::Pose camera_pose;
sl::TRACKING_STATE tracking_state = zed.getPosition(camera_pose, sl::REFERENCE_FRAME_WORLD);
if (tracking_state == TRACKING_STATE_OK) {
				//float translation_left_to_center = zed.getCameraInformation().calibration_parameters.T.x * 0.5f;//60mm
				// getPosition() outputs the position of the Camera Frame, which is located on the left eye of the camera.
				// To get the position of the center of the camera, we transform the pose data into a new frame located at the center of the camera.
				// The generic formula used here is: Pose(new reference frame) = M.inverse() * Pose (camera frame) * M, where M is the transform between two frames.
				//transformPose(camera_pose.pose_data, translation_left_to_center); // Get the pose at the center of the camera (baseline/2 on X axis)
				quaternion = camera_pose.getOrientation();
				rotation_marrix = camera_pose.getRotationMatrix();
				//std::cout << "rotation_matrix:" << tranform_sl_matrix(rotation_marrix) << std::endl;
				rotation = camera_pose.getEulerAngles(); // due to ours systems adopt left eye of the camera as the center.so we do not need to transform further
				translation = camera_pose.getTranslation();
}

以上代码是zed摄像头获取IMU的数据,直接有接口可以获取数据,有欧拉角,四元素,旋转矩阵,平移量。

上面数据的方向一切都是以惯导移动之后的方向作为向量的方向!这一点很重要!

例如:要实现移动之后的摄像头坐标转换到移动之前的坐标系,设现在zed的坐标系为xyz,移动之前的为XYZ,那么计算的公式为:

Rotation_matrix*[x+translation.x, y+translation.y, z+translation.z]T=[X, Y, Z]T;

猜你喜欢

转载自blog.csdn.net/Touch_Dream/article/details/84068059