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

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;

你可能感兴趣的:(图像处理,三维世界)