Help I'm playing around with ARKit's Image detection and I have no idea why every image I place in the AR Reference folder has an error:
AR reference image 'name' must have non zero positive width
I'm not really sure what that means and I'm not having any luck when I google it.
How do i fix this?
Typically, you create reference images in your Xcode project's asset catalog: In your asset catalog, use the Add (+) button to create an AR Resource Group. Drag image files into the resource group to create AR Reference Image entries in the asset catalog.
To accurately detect the position and orientation of a 2D image in the real world, ARKit requires preprocessed image data and knowledge of the image's real-world dimensions. The ARReferenceImage class encapsulates this information.
The ARReferenceImage class encapsulates this information. To enable image detection in an AR session, pass a collection of reference images to your session configuration's detectionImages property.
For each reference image, use the Xcode inspector panel to provide the real-world size at which you want ARKit to recognize the image. (You can also provide a descriptive name, which appears as the name property at runtime and can be useful for debugging.)
When you add an AR reference image to your asset catalog, you need to add a physical size:
This is necessary for ARKit to locate the image in the user's physical environment — otherwise it can't tell whether the image appears small in the camera image because it's physically small and nearby or because it's large and far away.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With