Instance Method

transformedMetadataObjectForMetadataObject:

Converts a metadata object’s visual properties to layer coordinates.

Declaration

- (AVMetadataObject *)transformedMetadataObjectForMetadataObject:(AVMetadataObject *)metadataObject;

Parameters

metadataObject

The metadata object whose visual properties you want to convert. The metadata object must originate from the same AVCaptureInput as the preview layer.

Return Value

A metadata object whose visual properties have been converted into layer coordinates, or nil if the metadataObject originates from an input source other than that of the preview layer.

Discussion

A metadata object’s bounds may be expressed as a rectangle, where an origin point of (0.0, 0.0) represents the top-left corner of an unrotated picture and (1.0, 1.0) represents the bottom-right corner of an unrotated picture. Face metadata objects also express a yaw and roll angle with respect to an unrotated picture. This method converts all of the metadata object’s visual properties to the coordinate space of the layer, taking into account the layer’s orientation, mirroring, bounds, and videoGravity.

See Also

Converting Between Coordinate Systems

- captureDevicePointOfInterestForPoint:

Converts a point from layer coordinates to the coordinate space of the capture device.

- pointForCaptureDevicePointOfInterest:

Converts a point from the coordinate space of the capture device to the coordinate space of the layer.

- rectForMetadataOutputRectOfInterest:

Converts a rectangle in the coordinate system used for metadata outputs to one in the preview layer’s coordinate system.

- metadataOutputRectOfInterestForRect:

Converts a rectangle in the preview layer’s coordinate system to one in the coordinate system used for metadata outputs.