12 Replies
      Latest reply on Dec 5, 2018 5:13 PM by fritza
      Ysee-kzsln Level 1 Level 1 (0 points)

        I have noticed that all of my project using a specific image reference could not load on my application :

         

         

        2018-06-13 13:51:39.699458+0200 RABTP[1111:192787] [Technique] Could not add planar object for detection: <ARReferenceImage: 0x2839bc000 name="Custom_Marker_2" physical-size=(0.000, 0.000)> Reason: 4
        2018-06-13 13:51:39.704807+0200 RABTP[1111:192787] [Session] Session (0x12dd1cfd0): 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: Target_NEW, Custom_Marker_2, NSLocalizedRecoverySuggestion=Make sure that all reference images are greater than 100 pixels and have a positive physical size in meters., ARErrorItems=(
            "Target_NEW",
            "Custom_Marker_2"
        ), NSLocalizedDescription=Invalid reference image.}
        

        However, all of my image references have a positive physical size in meters. This issue appear onyly on Xcode 10.

         

        Regards,

        • Re: Reference images have an invalid size Xcode 10
          Ysee-kzsln Level 1 Level 1 (0 points)

          Still have the same issue with Xcode Version 10.0 beta 4 (10L213o)

           

          2018-07-18 15:37:12.153485+0200 RABTP[400:25793] [Technique] Could not add planar object for detection: <ARReferenceImage: 0x283089400 name="Target" physicalSize=(0.145, 0.145)> Reason: 15
          2018-07-18 15:37:12.153739+0200 RABTP[400:25793] [Session] Session (0x102a31ee0): did fail with error: Error Domain=com.apple.arkit.error Code=300 UserInfo={NSLocalizedFailureReason=<redacted>, NSLocalizedRecoverySuggestion=<redacted>, ARErrorItems=<redacted>, NSLocalizedDescription=<redacted>}
          session(_:didFailWithError:): Invalid reference image.
          
          • Re: Reference images have an invalid size Xcode 10
            moaner Level 1 Level 1 (0 points)

            Hey, guys!

            Had the same problem. Solved using JPEG format instead of PNG.

            XCode version: 10.0 beta 5 (Jul 30, 2018).

              • Re: Reference images have an invalid size Xcode 10
                4k4 Apple Staff Apple Staff (10 points)

                Hi moaner,

                 

                That's an interesting potential workaround. Likewise would you mind filing a bug report at <https://developer.apple.com/bug-reporting/>

                 

                It would be very helpful.

                  • Re: Reference images have an invalid size Xcode 10
                    fritza Level 1 Level 1 (0 points)

                    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.

                  • Re: Reference images have an invalid size Xcode 10
                    LGRos Level 1 Level 1 (0 points)

                    I have tried that as well but no permanent success. In my example there also appears to be some problem with units conversion from meter to inch... I set the unit selector to meter and afterwards entered the size in meter (0,09 m - more than 1 inch for sure). The error message was telling me that the size should be one inch minimum. I changed the unit to inch and the program changed the value to something smaller than 1 inch. After changing those numbers and units backwards and forwards the photo was finally accepted.

                    • Re: Reference images have an invalid size Xcode 10
                      kboy Level 1 Level 1 (0 points)

                      This solution worked! Thanks!