Type Method

extrinsicMatrix(from:to:)

The relative extrinsic matrix from one capture device to another.

Declaration

class func extrinsicMatrix(from fromDevice: AVCaptureDevice, to toDevice: AVCaptureDevice) -> Data?

Parameters

fromDevice

The capture device that represents the source camera. If you pass a nil value for this argument, an invalidArgumentException is generated.

toDevice

The capture device that represents the destination camera. If you pass a nil value for this argument, an invalidArgumentException is generated.

Return Value

A Data containing a matrix_float4x3 matrix, which is a column major with 3 rows and 4 columns.

Discussion

The extrinsic matrix consists of a unitless 3x3 rotation matrix (R) on the left and a translation (t) 3x1 column vector on the right, whose units are millimeters. The matrix expresses the destination camera’s extrinsics relative to the source camera. If X_from is a 3D point in the source camera’s coordinate system, you project it into the destination camera’s coordinate system with X_to = [R | t] * X_from.

Only physical cameras for which factory calibrations exist provide an extrinsic matrix. Virtual device cameras return nil.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software