问题
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?
回答1:
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.
回答2:
It could be because there are some limitations with the software:
ARKit performs best when the host app is searching for 25 or fewer distinct images in a given environment
Developers should provide reference images, including information on physical size, to optimize detection
ARKit does not track changes to the position so precise placement of virtual assets could pose a problem
A separate section covers potential interruptions to the AR experience
Also, please refer see this answer that might reference you into right direction
回答3:
In my case, after a lot of trial and error i realised the problem happened because i had exactly the same image with the same file name as the reference image, in a normal asset catalog (ie a duplicate). Changing the name of the reference image fixed it.
来源:https://stackoverflow.com/questions/49757153/xcode-error-ar-reference-image-must-have-non-zero-positive-width