I hope the topic isn't stale. I'm using Xcode 10.1 (10B61) and am seeing the same behavior.
Given that Xcode 10 is long out of beta, and that nobody seems to be asking about it any more, I'm hoping there's now a solution.
I'm adapting a tutorial, "Triassic Loupe" from raywenderlich.com (blessed be its name) to explore AR reference-image techniques. It worked (properly identified the target planes and overlaid them with a video) with my new images. I did further work, meaning only to replace the video overlay with a cgImage. Now when I execute the following code:
static let imageGroup = "OIplanar"
private func setupImageDetection() {
imageConfiguration = ARImageTrackingConfiguration()
guard let referenceImages = ARReferenceImage
.referenceImages(
inGroupNamed: ImageViewController.imageGroup,
bundle: nil) else {
fatalError(#function)
}
imageConfiguration.trackingImages = referenceImages
}
referenceImages at line 9 shows all images correctly identified, but with physicalSize .zero:
(lldb) po referenceImages
▿ 6 elements
- 0 :
- 1 :
- 2 :
- 3 :
- 4 :
- 5 :
(lldb) po referenceImages
▿ 6 elements
- 0 : <ARReferenceImage: 0x283f78a50 name="Lion" physicalSize=(0.000, 0.000)>
- 1 : <ARReferenceImage: 0x283f79270 name="QST" physicalSize=(0.000, 0.000)>
- 2 : <ARReferenceImage: 0x283f4f570 name="Bull king" physicalSize=(0.000, 0.000)>
- 3 : <ARReferenceImage: 0x283f79450 name="Middle Attendants" physicalSize=(0.000, 0.000)>
- 4 : <ARReferenceImage: 0x283f796d0 name="Extreme priest" physicalSize=(0.000, 0.000)>
- 5 : <ARReferenceImage: 0x283f40460 name="Cuneiform" physicalSize=(0.000, 0.000)>
(lldb) po referenceImages
▿ 6 elements
- 0 : {ARReferenceImage: 0x283f78a50 name="Lion" physicalSize=(0.000, 0.000)}
- 1 : {ARReferenceImage: 0x283f79270 name="QST" physicalSize=(0.000, 0.000)}
- 2 : {ARReferenceImage: 0x283f4f570 name="Bull king" physicalSize=(0.000, 0.000)}
- 3 : {ARReferenceImage: 0x283f79450 name="Middle Attendants" physicalSize=(0.000, 0.000)}
- 4 : {ARReferenceImage: 0x283f796d0 name="Extreme priest" physicalSize=(0.000, 0.000)}
- 5 : {ARReferenceImage: 0x283f40460 name="Cuneiform" physicalSize=(0.000, 0.000)}
(Sorry for the repeats, the literal-text style gets very confused by angle brackets and I can't fix or delete them in-place. For all I know you'll see all three.)
When execution proceeds to sceneView.session.run(imageConfiguration), the same error as elsewhere in this thread reaches session(_:didFailWithError:) -
... (same for the other images) ...
2018-12-05 18:48:17.183728-0600 Not OI[25465:9988437] [Technique] Could not add planar object for detection: <ARReferenceImage: 0x283f40460 name="Cuneiform" physicalSize=(0.000, 0.000)> Reason: 4
2018-12-05 18:48:17.184038-0600 Not OI[25465:9988437] [Session] Session (0x104b09bb0): did fail with error: Error Domain=com.apple.arkit.error Code=300 "Invalid reference image." UserInfo={NSLocalizedFailureReason=One or more reference images have an invalid size: Lion, QST, Bull king, Middle Attendants, Extreme priest, Cuneiform, NSLocalizedRecoverySuggestion=Make sure that all reference images are greater than 100 pixels and have a positive physical size in meters., ARErrorItems=(
Lion,
QST,
"Bull king",
"Middle Attendants",
"Extreme priest",
Cuneiform
), NSLocalizedDescription=Invalid reference image.}
Following other suggestions I converted to all JPEG (no), then all PNG (no), editing the respective Contents.json files to match. Here is what's in the Contents.json for one of them:
{ "images" : [
{ "idiom" : "universal", "filename" : "Cuneiform.jpg" }
],
"info" : { "version" : 1, "author" : "xcode" }, "properties" : { "width" : 0.9144000000000001 }
}
The conversions were by way of a script using sips to convert and sed to edit the suffixes in the Contents.jsons. Remember I had this trouble before I did any of that. No change. Cutting the dimensions from ~2800 on a side to 1024 didn't help. (512 got me dimension-too-small runtime warnings, and I lacked the patience to correct those by hand.)
I know I should retrace my steps through the tutorial (no, I didn't add SCM until after I crossed the line to un-workland). I'll do that tomorrow after I go home and sleep.
In the mean time, I hope someone has figured out what exposes this issue and how I can avoid it.