Main Content


Convert extrinsics to camera pose

Since R2022b



    cameraPose = extr2pose(camExtrinsics) returns the camera pose, cameraPose, in world coordinates, given the camera extrinsics.


    collapse all

    Create a 3-D rigid geometric transformation from a rotation matrix and a translation vector.

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

    Compute the camera pose in world coordinates.

    cameraPose = extr2pose(tform)
    cameraPose = 
      rigidtform3d with properties:
        Dimensionality: 3
           Translation: [0 0 10]
                     R: [3x3 double]
                     A: [1     0     0     0
                         0     1     0     0
                         0     0     1    10
                         0     0     0     1]

    Input Arguments

    collapse all

    Camera extrinsics, specified as a rigidtform3d object. The extrinsics are a transformation from world coordinates to camera coordinates that enables you to transform points from the world coordinate system to the camera coordinate system.

    Output Arguments

    collapse all

    Camera pose in world coordinates, returned as a rigidtform3d object. cameraPose is the inverse of camExtrinsics as calculated using the invert function.

    Extended Capabilities

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

    Version History

    Introduced in R2022b

    expand all