Instance Method

transformedMetadataObjectForMetadataObject:connection:

Converts the visual properties of an AVMetadataObject to the output’s coordinates.

Declaration

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

Parameters

metadataObject

An AVMetadataObject originating from the same AVCaptureInput as the receiver.

connection

The receiver's connection whose AVCaptureInput matches that of the metadata object to be converted.

Return Value

An AVMetadataObject whose properties are in output coordinates, or nil if metadataObject originates from an input source other than the preview layer.

Discussion

This method converts the visual properties in the coordinate space of the supplied AVMetadataObject to the coordinate space of the output. The conversion takes orientation, mirroring, and scaling into consideration and alters the visual properties of the provided metadata object to match the physical rotation and mirroring of the sample buffers provided by the receiver through the indicated connection.

This means that for video data output (AVCaptureVideoDataOutput), adjusted metadata object coordinates are rotated and mirrored. For still image (AVCaptureStillImageOutput) and movie file (AVCaptureMovieFileOutput) output, they are not. Instead, the rotation and mirroring of the metadata object coordinates for these two types of output are determined on playback.

See Also

Converting Between Coordinate Systems

- metadataOutputRectOfInterestForRect:

Converts a rectangle in the capture output object’s coordinate system to one in the coordinate system used for metadata outputs.

- rectForMetadataOutputRectOfInterest:

Converts a rectangle in the coordinate system used for metadata outputs to one in the capture output object’s coordinate system.