Main Content

extrinsicsToCameraPose

Convert extrinsics to camera pose

Description

cameraPose = extrinsicsToCameraPose(tform) returns a rigid3d object that contains the camera pose, cameraPose, in world coordinates. tform is a transformation from world coordinates to camera coordinates, specified as a rigid3d object.

example

[orientation,location] = extrinsicsToCameraPose(rotationMatrix,translationVector) returns 3-D camera pose orientation and location in world coordinates. The inputs, rotationMatrix and translationVector, represent the transformation from world coordinates to camera coordinates.

Examples

collapse all

Create a rotation matrix and a translation vector.

rotationMatrix = eye(3);
translationVector = [0 0 -10];

Compute the camera orientation matrix and location vector in world coordinates.

[orientation,location] = extrinsicsToCameraPose(rotationMatrix,translationVector)
orientation = 3×3

     1     0     0
     0     1     0
     0     0     1

location = 1×3

     0     0    10

Compute the camera pose in world coordinates as a rigid 3-D object.

tform = rigid3d(rotationMatrix,translationVector);
cameraPose = extrinsicsToCameraPose(tform)
cameraPose = 
  rigid3d with properties:

       Rotation: [3x3 double]
    Translation: [0 0 10]

Input Arguments

collapse all

Transformation from world coordinates to camera coordinates, specified as a rigid3d object. The transformation allows you to transform points from the world coordinate system to the camera coordinate system.

3-D rotation, specified as a 3-by-3 matrix. The rotation matrix, together with the translation vector allows you to transform points from the world coordinate system to the camera coordinate system.

Data Types: double | single

3-D translation, specified as a 1-by-3 vector. The translation vector together with the rotation matrix, enables you to transform points from the world coordinate system to the camera coordinate system.

Data Types: double | single

Output Arguments

collapse all

Camera pose in world coordinates, returned as a rigid3d object. cameraPose is computed as:

cameraPose.Rotation = tform.Rotation'
cameraPose.Translation = -tform.Translation * tform.Rotation'

3-D orientation of the camera in world coordinates, returned as a 3-by-3 matrix.

The relationship between the rotation matrix and the output orientation matrix is:

orientation = rotationMatrix'

3-D location of the camera in world coordinates, specified as a three-element vector.

The relationship between the translation vector and the output orientation matrix is:

location = –translationVector*rotationMatrix'

Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.

Introduced in R2016b