Instance Method

displayTransform(for:viewportSize:)

Returns an affine transform for converting between normalized image coordinates and a coordinate space appropriate for rendering the camera image onscreen.

Declaration

func displayTransform(for orientation: UIInterfaceOrientation, viewportSize: CGSize) -> CGAffineTransform

Parameters

orientation

The orientation intended for presenting the view.

viewportSize

The size, in points, of the view intended for rendering the camera image.

Return Value

A transform matrix that converts from normalized image coordinates in the captured image to normalized image coordinates that account for the specified parameters.

Discussion

Normalized image coordinates range from (0,0) in the upper left corner of the image to (1,1) in the lower right corner.

This method creates an affine transform representing the rotation and aspect-fit crop operations necessary to adapt the camera image to the specified orientation and to the aspect ratio of the specified viewport. The affine transform does not scale to the viewport's pixel size.

The capturedImage pixel buffer is the original image captured by the device camera, and thus not adjusted for device orientation or view aspect ratio.

See Also

Examining Scene Parameters

var camera: ARCamera

Information about the camera position, orientation, and imaging parameters used to capture the frame.

var lightEstimate: ARLightEstimate?

An estimate of lighting conditions based on the camera image.