metadataOutputRectConverted(fromOutputRect:)
Converts a rectangle in the capture output object’s coordinate system to one in the coordinate system used for metadata outputs.
Declaration
func metadataOutputRectConverted(fromOutputRect rectInOutputCoordinates: CGRect) -> CGRectParameters
- rectInOutputCoordinates:
A rectangle in the Avcaptureoutput object’s coordinate system.
Return Value
A rectangle in the AVCaptureMetadataOutput coordinate system.
Discussion
An AVCaptureMetadataOutput object expresses its rectOfInterest as a CGRect where 0,0 represents the top-left of the picture area, and 1,1 represents the bottom-right on an unrotated picture. This convenience method converts a rectangle in the coordinate space of the output to a rectangle of interest in the coordinate space of a metadata output whose capture device provides input to the output. The conversion takes orientation, mirroring, and scaling into consideration.
See transformedMetadataObject(for:connection:) for a full discussion of how the system applies orientation and mirroring to sample buffers passing through the output.