Main Content


Convert camera pose to extrinsics

Since R2022b



    camExtrinsics = pose2extr(cameraPose) returns the camera extrinsics, or the transformation from world coordinates to camera coordinates, for a camera with pose cameraPose in world coordinates.


    collapse all

    Create a camera pose from a 3-D orientation matrix and location vector.

    orientation = eye(3);
    location = [0 0 10];
    cameraPose = rigidtform3d(orientation,location);

    Compute the transformation from world coordinates to camera coordinates.

    tform = pose2extr(cameraPose)
    tform = 
      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

    Orientation and location of the camera in world coordinates, specified as a rigidtform3d object.

    Output Arguments

    collapse all

    Camera extrinsics, returned 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. camExtrinsics is the inverse of cameraPose 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