init(_:orientation:physicalWidth:)
Creates a new reference image from a Core Video pixel buffer.
Declaration
init(_ pixelBuffer: CVPixelBuffer, orientation: CGImagePropertyOrientation, physicalWidth: CGFloat)Parameters
- pixelBuffer:
A Core Video pixel buffer containing the image data for the new image.
- orientation:
The intended display orientation for the image.
- physicalWidth:
The real-world width, in meters, of the image.
Discussion
To accurately recognize the position and orientation of an image in the AR environment, ARKit must know the image’s physical size. When you call this initializer, ARKit uses the physicalWidth measurement and orientation you provide together with the aspect ratio of the image itself to calculate the physical height. Use the physicalSize property of the created ARReferenceImage object to retrieve these values.