Search Unity

Bug Image tracking for ARFoundation on iOS detects multiple ARTrackedImage from a single ReferenceImage

Discussion in 'AR' started by Pomperoo, May 29, 2021.

  1. Pomperoo

    Pomperoo

    Joined:
    Feb 8, 2018
    Posts:
    1
    Hello everyone, I have quite a peculiar problem with the app I'm developing at the moment. I'm using ARFoundation, ARSubsystems, ARCore and ARKit packages version 4.1.7. I've tested packages 3.10 and 2.1 also and the issue remains the same. I'm using Unity 2019.4.21f.

    The initial situation is this : I have a deck of playing cards. The playing cards are added to an XRReferenceImageLibrary and I have a prefab that is spawned when the cards are detected that play a video over the cards. Basic stuff. I've tested the app thoroughly on Android on my Samsung Galaxy S9 and the app works pretty flawlessly.

    The problem arises when I try to test for iOS. I have Unity Cloud setup to make an iOS build and when I install the build on my Ipad (6th generation), the app works really well for most of the cards, but some cards are really problematic.

    For example, there is this one card that, even when launching a clean instance of the app, within 5 seconds of tracking the card will trigger ImageManagerOnTrackedImagesChanged in my ImageTrackingObjectManager with ARTrackedImagesChangedEventArgs for 5 or 6 different ARTrackedImages.

    I've logged the the process for added images and despite there being only one card in front of the camera the entire time, we can see the same card is recognized as multiple tracked images :

    --------------------------------------------------------------------------------------------------------------------------------------
    May 28 18:59:44 IpadPSA-38 VoiAR(UnityFramework)[632] <Notice>: ASDFASDF onEnable started.
    May 28 18:59:49 IpadPSA-38 VoiAR(UnityFramework)[632] <Notice>: ASDFASDF Will add image : ARTrackedImage 074FA9F5069C1030-1DE0FC529ECD7B84 (UnityEngine.XR.ARFoundation.ARTrackedImage)
    May 28 18:59:49 IpadPSA-38 VoiAR(UnityFramework)[632] <Notice>: ASDFASDF Will add image.nativePtr : 4768318016
    May 28 18:59:49 IpadPSA-38 VoiAR(UnityFramework)[632] <Notice>: ASDFASDF Will add image.referenceImage. : GUID: 'eacba8cd-4a96-4bb9-bad6-fd1101b1ea9a', Texture GUID: '2d3ee000-9451-a304-d8a9-6bf6b1d87747` Size: specified (0.2, 0.2)
    May 28 18:59:49 IpadPSA-38 VoiAR(UnityFramework)[632] <Notice>: ASDFASDF Will add image.referenceImage.guid : eacba8cd-4a96-4bb9-bad6-fd1101b1ea9a
    May 28 18:59:49 IpadPSA-38 VoiAR(UnityFramework)[632] <Notice>: ASDFASDF Will add image.referenceImage.name : 47
    May 28 18:59:49 IpadPSA-38 VoiAR(UnityFramework)[632] <Notice>: ASDFASDF image added for index : 45
    May 28 18:59:49 IpadPSA-38 VoiAR(UnityFramework)[632] <Notice>: ASDFASDF : will play video for prefab instance index : 45
    May 28 18:59:52 IpadPSA-38 VoiAR(UnityFramework)[632] <Notice>: ASDFASDF Will add image : ARTrackedImage 5C407647A0F8EC98-F3D5DB9D005C1B9F (UnityEngine.XR.ARFoundation.ARTrackedImage)
    May 28 18:59:52 IpadPSA-38 VoiAR(UnityFramework)[632] <Notice>: ASDFASDF Will add image.nativePtr : 4777770144
    May 28 18:59:52 IpadPSA-38 VoiAR(UnityFramework)[632] <Notice>: ASDFASDF Will add image.referenceImage. : GUID: 'f2f10cf2-0da4-4e99-827a-28be7e276c16', Texture GUID: 'da6667fd-b854-6f54-8bb1-33e906939686` Size: specified (0.2, 0.2)
    May 28 18:59:52 IpadPSA-38 VoiAR(UnityFramework)[632] <Notice>: ASDFASDF Will add image.referenceImage.guid : f2f10cf2-0da4-4e99-827a-28be7e276c16
    May 28 18:59:52 IpadPSA-38 VoiAR(UnityFramework)[632] <Notice>: ASDFASDF Will add image.referenceImage.name : 48
    May 28 18:59:52 IpadPSA-38 VoiAR(UnityFramework)[632] <Notice>: ASDFASDF image added for index : 46
    May 28 18:59:52 IpadPSA-38 VoiAR(UnityFramework)[632] <Notice>: ASDFASDF : will play video for prefab instance index : 46
    May 28 18:59:53 IpadPSA-38 VoiAR(UnityFramework)[632] <Notice>: ASDFASDF Will add image : ARTrackedImage F24D31485E4B39E8-35C9936B13A05BA5 (UnityEngine.XR.ARFoundation.ARTrackedImage)
    May 28 18:59:53 IpadPSA-38 VoiAR(UnityFramework)[632] <Notice>: ASDFASDF Will add image.nativePtr : 4778977728
    May 28 18:59:53 IpadPSA-38 VoiAR(UnityFramework)[632] <Notice>: ASDFASDF Will add image.referenceImage. : GUID: '96b0c3ed-230e-4013-a00a-4f69a8a5d106', Texture GUID: '17e8f9d5-8eff-60f4-f8e4-9f3478deaaa2` Size: specified (0.2, 0.2)
    May 28 18:59:53 IpadPSA-38 VoiAR(UnityFramework)[632] <Notice>: ASDFASDF Will add image.referenceImage.guid : 96b0c3ed-230e-4013-a00a-4f69a8a5d106
    May 28 18:59:53 IpadPSA-38 VoiAR(UnityFramework)[632] <Notice>: ASDFASDF Will add image.referenceImage.name : 46
    May 28 18:59:53 IpadPSA-38 VoiAR(UnityFramework)[632] <Notice>: ASDFASDF image added for index : 44
    May 28 18:59:53 IpadPSA-38 VoiAR(UnityFramework)[632] <Notice>: ASDFASDF : will play video for prefab instance index : 44
    May 28 18:59:55 IpadPSA-38 VoiAR(UnityFramework)[632] <Notice>: ASDFASDF Will add image : ARTrackedImage E14E48EA9C2DAEB8-81B8EB1857739C86 (UnityEngine.XR.ARFoundation.ARTrackedImage)
    May 28 18:59:55 IpadPSA-38 VoiAR(UnityFramework)[632] <Notice>: ASDFASDF Will add image.nativePtr : 4778765648
    May 28 18:59:55 IpadPSA-38 VoiAR(UnityFramework)[632] <Notice>: ASDFASDF Will add image.referenceImage. : GUID: '9d4252dc-e930-4131-99e8-f16e7275b423', Texture GUID: '7ae0eef8-a572-f134-bb99-97ccb4fa1abd` Size: specified (0.2, 0.2)
    May 28 18:59:55 IpadPSA-38 VoiAR(UnityFramework)[632] <Notice>: ASDFASDF Will add image.referenceImage.guid : 9d4252dc-e930-4131-99e8-f16e7275b423
    May 28 18:59:55 IpadPSA-38 VoiAR(UnityFramework)[632] <Notice>: ASDFASDF Will add image.referenceImage.name : 16
    May 28 18:59:55 IpadPSA-38 VoiAR(UnityFramework)[632] <Notice>: ASDFASDF image added for index : 15
    May 28 18:59:55 IpadPSA-38 VoiAR(UnityFramework)[632] <Notice>: ASDFASDF : will play video for prefab instance index : 15
    May 28 18:59:55 IpadPSA-38 VoiAR(UnityFramework)[632] <Notice>: ASDFASDF Will add image : ARTrackedImage 654D354C29613CD1-3EDE3451C1510A87 (UnityEngine.XR.ARFoundation.ARTrackedImage)
    May 28 18:59:55 IpadPSA-38 VoiAR(UnityFramework)[632] <Notice>: ASDFASDF Will add image.nativePtr : 4768459472
    May 28 18:59:55 IpadPSA-38 VoiAR(UnityFramework)[632] <Notice>: ASDFASDF Will add image.referenceImage. : GUID: '6839d583-0fa3-46cf-aee4-b98865b7ef45', Texture GUID: 'ea1d2a9c-ecd1-12d4-98ef-902087be24f7` Size: specified (0.2, 0.2)
    May 28 18:59:55 IpadPSA-38 VoiAR(UnityFramework)[632] <Notice>: ASDFASDF Will add image.referenceImage.guid : 6839d583-0fa3-46cf-aee4-b98865b7ef45
    May 28 18:59:55 IpadPSA-38 VoiAR(UnityFramework)[632] <Notice>: ASDFASDF Will add image.referenceImage.name : 41
    May 28 18:59:55 IpadPSA-38 VoiAR(UnityFramework)[632] <Notice>: ASDFASDF image added for index : 39
    May 28 18:59:55 IpadPSA-38 VoiAR(UnityFramework)[632] <Notice>: ASDFASDF : will play video for prefab instance index : 39
    May 28 18:59:55 IpadPSA-38 VoiAR(UnityFramework)[632] <Notice>: ASDFASDF stopped video for prefab instance index : 15
    May 28 18:59:56 IpadPSA-38 VoiAR(UnityFramework)[632] <Notice>: ASDFASDF stopped video for prefab instance index : 46
    May 28 18:59:56 IpadPSA-38 VoiAR(UnityFramework)[632] <Notice>: ASDFASDF stopped video for prefab instance index : 45
    May 28 18:59:56 IpadPSA-38 VoiAR(UnityFramework)[632] <Notice>: ASDFASDF stopped video for prefab instance index : 44
    May 28 18:59:56 IpadPSA-38 VoiAR(UnityFramework)[632] <Notice>: ASDFASDF stopped video for prefab instance index : 39
    May 28 18:59:56 IpadPSA-38 VoiAR(UnityFramework)[632] <Notice>: ASDFASDF : start animate loading in update
    --------------------------------------------------------------------------------------------------------------------------------------



    The result is that multiple videos will all play one on top of the others. Sometimes one the ARTrackedImage will stop being tracked and one of the video will stop, but in this instance we can see that the single card is simultaneously being tracked as multiple ARTrackedImage. The spatial tracking has no problem and videos will all follow the card while it's being moved. Sometimes all the simultaneous videos being started or stopped will also just flat out crash the app.

    It would easy to assume that the cards are just too similar to one another, but they really are not. And on Android I've never ever had this problem once.

    I've also used arcoreimg tool (arcoreimg.exe eval-img --input_image_path=) to test the score of each cards and some of the cards being misrecognized have a score of 100 or 90.

    I realize that iOS will use ARKit provider and not ARCore, but it's still baffling that the cards would be misrecognized by the AR engine.

    Has anyone ever seen something similar? At this point any help would be greatly appreciated.


    EDIT : I've just done another test where I have had the same single card end up being recognized, in a minute or two, at one point or another, as 18 different cards which seems insane. And some of the cards that where being recognized could not have been any more different.
     
    Last edited: May 29, 2021
  2. TreyK-47

    TreyK-47

    Unity Technologies

    Joined:
    Oct 22, 2019
    Posts:
    1,820