Type Method

extrinsicMatrixFromDevice:toDevice:

The relative extrinsic matrix from one capture device to another.

Declaration

+ (NSData *)extrinsicMatrixFromDevice:(AVCaptureDevice *)fromDevice toDevice:(AVCaptureDevice *)toDevice;

Parameters

fromDevice

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

toDevice

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

Return Value

An NSData 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.