Search Unity

ARFoundation ImageTracking Sample scene doesnt generate image database

Discussion in 'AR' started by PTW_AR, May 25, 2019.

  1. PTW_AR

    PTW_AR

    Joined:
    Jan 13, 2019
    Posts:
    13
    I'm trying to get the sample scene from the official github repo of ARFoundation 2.1 to work, but it doesnt generate the image database. The apk is working though and a camera feed can be seen on the display.

    The error codes:

    Failed to generated ARCore reference image library 'ReferenceImageLibrary'
    UnityEngine.GUIUtility:processEvent(Int32, IntPtr)

    BuildFailedException: Failed to generate image database. Output from arcoreimg:

    stdout:

    ====

    stderr:
    C:\Users\XXX\AppData\Local\Temp\4d676c83db4046c2bd0d68b010cd84ef\39344433fd8c4712b4ee109a5c73a2b2.txt:line 1: Invalid width specified: 0.
    ====
    UnityEditor.XR.ARCore.ARCorePreprocessBuild.BuildImageTrackingAssets () (at Library/PackageCache/com.unity.xr.arcore@2.1.0-preview.4/Editor/ARCoreBuildProcessor.cs:279)
    UnityEditor.XR.ARCore.ARCorePreprocessBuild.OnPreprocessBuild (UnityEditor.Build.Reporting.BuildReport report) (at Library/PackageCache/com.unity.xr.arcore@2.1.0-preview.4/Editor/ARCoreBuildProcessor.cs:32)
    UnityEditor.Build.BuildPipelineInterfaces+<OnBuildPreProcess>c__AnonStorey0.<>m__1 (UnityEditor.Build.IPreprocessBuildWithReport bpp) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/BuildPipelineInterfaces.cs:376)
    UnityEditor.Build.BuildPipelineInterfaces.InvokeCallbackInterfacesPair[T1,T2] (System.Collections.Generic.List`1[T] oneInterfaces, System.Action`1[T] invocationOne, System.Collections.Generic.List`1[T] twoInterfaces, System.Action`1[T] invocationTwo, System.Boolean exitOnFailure) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/BuildPipelineInterfaces.cs:356)
    UnityEngine.GUIUtility:processEvent(Int32, IntPtr)


    I'm using Unity 2019.1.0f2 on Windows 7, all packages, sdk's etc should be installed. My target is a Samsung Galaxy Tab S4 with Android 9, although that shouldn't matter here.

    Actually tried the same thing on a different PC with Windows 10 and Unity 2019.1.3f1, same problem. I guess I'm missing some packages? I'm really clueless.

    (On a side note: Build and run doesnt work for me either with ARFoundation, but I guess that's another story on its own).

    Does anyone have a solution for my problem? I'm tired of working on ARKit and ARCore simultanously and would really like to utilize ARFoundation. Thanks.

    edit: attached a picture of my packege manager window.
     

    Attached Files:

    Last edited: May 25, 2019
  2. I_Jemin

    I_Jemin

    Joined:
    Jul 31, 2014
    Posts:
    11
    I use ARFoundation 2.10 with ARKit 2.10, iPhone XS, and I found that other ARFoundation features work correctly, but ARTrackedImageManager doesn't work. I tested it in both empty project and sample project on GitHub.

    I guess we need to wait for a hotfix.
     
  3. tdmowrer

    tdmowrer

    Joined:
    Apr 21, 2017
    Posts:
    605
    The issue has to do with how the image width is translated to a string. Depending on your region settings, it could be something like "0.25" or "0,25" (comma vs period). The ARCore image library generation tool expects a period. A fix is coming soon. In the meantime, you can try modifying the ReferenceImageLibrary to not specify widths for the images. (Note, this will only work on ARCore as ARKit requires widths for all images.)
     
  4. hendrik_unity793

    hendrik_unity793

    Joined:
    May 27, 2019
    Posts:
    1
    Any hints on how to do that? Just ticking off "Specify size" on the image doesn't seem to help (Unity 2019.2b with ARCore 2.1 und AR Foundation 2.1), I am still getting the build error mentioned above when trying to build an apk.
     
  5. tdmowrer

    tdmowrer

    Joined:
    Apr 21, 2017
    Posts:
    605
    What are the contents of C:\Users\XXX\AppData\Local\Temp\4d676c83db4046c2bd0d68b010cd84ef\39344433fd8c4712b4ee109a5c73a2b2.txt ?
     
  6. PTW_AR

    PTW_AR

    Joined:
    Jan 13, 2019
    Posts:
    13
    I would gladly provide the contents of that .txt-file, but I cant find it in the given directory (even after building it again). I assume it's deleted or moved to another directory? Any pointers on how to save the error file in the building process? I couldn't find it in the documentation.

    I changed some unity console settings: "stack trace logging --> error" from "script only" to "full", which returned a different error for the first error message. Don't think it will be particularily useful, but I guess it won't hurt to post it.

    Code (CSharp):
    1. Failed to generated ARCore reference image library 'ReferenceImageLibrary'
    2. 0x00000001422E93CC (Unity) StackWalker::GetCurrentCallstack
    3. 0x00000001422EC881 (Unity) StackWalker::ShowCallstack
    4. 0x0000000140A58695 (Unity) GetStacktrace
    5. 0x0000000142D06C60 (Unity) DebugStringToFile
    6. 0x0000000142317EC9 (Unity) DebugLogHandler_CUSTOM_Internal_Log
    7. 0x000000004017FE8B (Mono JIT Code) (wrapper managed-to-native) UnityEngine.DebugLogHandler:Internal_Log (UnityEngine.LogType,UnityEngine.LogOption,string,UnityEngine.Object)
    8. 0x000000004017FD4B (Mono JIT Code) [DebugLogHandler.cs:10] UnityEngine.DebugLogHandler:LogFormat (UnityEngine.LogType,UnityEngine.Object,string,object[])
    9. 0x000000004017F702 (Mono JIT Code) [Logger.cs:127] UnityEngine.Logger:LogFormat (UnityEngine.LogType,string,object[])
    10. 0x000000004017F432 (Mono JIT Code) [Debug.bindings.cs:135] UnityEngine.Debug:LogErrorFormat (string,object[])
    11. 0x000000004011DA63 (Mono JIT Code) [ARCoreBuildProcessor.cs:267] UnityEditor.XR.ARCore.ARCorePreprocessBuild:BuildImageTrackingAssets ()
    12. 0x000000004011882B (Mono JIT Code) [ARCoreBuildProcessor.cs:32] UnityEditor.XR.ARCore.ARCorePreprocessBuild:OnPreprocessBuild (UnityEditor.Build.Reporting.BuildReport)
    13. 0x00000000401184EF (Mono JIT Code) [BuildPipelineInterfaces.cs:376] UnityEditor.Build.BuildPipelineInterfaces/<OnBuildPreProcess>c__AnonStorey0:<>m__1 (UnityEditor.Build.IPreprocessBuildWithReport)
    14. 0x0000000040118082 (Mono JIT Code) [BuildPipelineInterfaces.cs:356] UnityEditor.Build.BuildPipelineInterfaces:InvokeCallbackInterfacesPair<T1_REF, T2_REF> (System.Collections.Generic.List`1<T1_REF>,System.Action`1<T1_REF>,System.Collections.Generic.List`1<T2_REF>,System.Action`1<T2_REF>,bool)
    15. 0x0000000040116FAB (Mono JIT Code) [BuildPipelineInterfaces.cs:374] UnityEditor.Build.BuildPipelineInterfaces:OnBuildPreProcess (UnityEditor.Build.Reporting.BuildReport)
    16. 0x000000002CB8AAFB (Mono JIT Code) (wrapper runtime-invoke) <Module>:runtime_invoke_void_object (object,intptr,intptr,intptr)
    17. 0x000007FEC964BBCB (mono-2.0-bdwgc) [mini-runtime.c:2809] mono_jit_runtime_invoke
    18. 0x000007FEC95D2252 (mono-2.0-bdwgc) [object.c:2919] do_runtime_invoke
    19. 0x000007FEC95DB25F (mono-2.0-bdwgc) [object.c:2966] mono_runtime_invoke
    20. 0x000000014227B036 (Unity) scripting_method_invoke
    21. 0x0000000142275335 (Unity) ScriptingInvocation::Invoke
    22. 0x0000000142270585 (Unity) ScriptingInvocation::Invoke<void>
    23. 0x000000013F9FE459 (Unity) Scripting::UnityEditor::Build::BuildPipelineInterfacesProxy::OnBuildPreProcess
    24. 0x00000001403E510D (Unity) BuildPlayer
    25. 0x00000001412E31DE (Unity) BuildPipeline::BuildPlayerInternalNoCheck
    26. 0x00000001412E11D3 (Unity) BuildPipeline_CUSTOM_BuildPlayerInternalNoCheck
    27. 0x0000000040031E43 (Mono JIT Code) (wrapper managed-to-native) UnityEditor.BuildPipeline:BuildPlayerInternalNoCheck (string[],string,string,UnityEditor.BuildTargetGroup,UnityEditor.BuildTarget,UnityEditor.BuildOptions,bool)
    28. 0x0000000040031283 (Mono JIT Code) [BuildPlayerWindowBuildMethods.cs:173] UnityEditor.BuildPlayerWindow/DefaultBuildMethods:BuildPlayer (UnityEditor.BuildPlayerOptions)
    29. 0x000000003FFC7CDB (Mono JIT Code) [BuildPlayerWindowBuildMethods.cs:98] UnityEditor.BuildPlayerWindow:CallBuildMethods (bool,UnityEditor.BuildOptions)
    30. 0x000000003FA68F33 (Mono JIT Code) [BuildPlayerWindow.cs:908] UnityEditor.BuildPlayerWindow:GUIBuildButtons (UnityEditor.Modules.IBuildWindowExtension,bool,bool,bool,UnityEditor.Build.BuildPlatform)
    31. 0x00000000435AB2EB (Mono JIT Code) [BuildPlayerWindow.cs:799] UnityEditor.BuildPlayerWindow:ShowBuildTargetSettings ()
    32. 0x000000004358F803 (Mono JIT Code) [BuildPlayerWindow.cs:367] UnityEditor.BuildPlayerWindow:OnGUI ()
    33. 0x0000000031B75670 (Mono JIT Code) (wrapper runtime-invoke) object:runtime_invoke_void__this__ (object,intptr,intptr,intptr)
    34. 0x000007FEC964BBCB (mono-2.0-bdwgc) [mini-runtime.c:2809] mono_jit_runtime_invoke
    35. 0x000007FEC95D2252 (mono-2.0-bdwgc) [object.c:2919] do_runtime_invoke
    36. 0x000007FEC95DB432 (mono-2.0-bdwgc) [object.c:3071] mono_runtime_invoke_checked
    37. 0x000007FEC95DBBC9 (mono-2.0-bdwgc) [object.c:5262] mono_runtime_try_invoke_array
    38. 0x000007FEC95DB3C6 (mono-2.0-bdwgc) [object.c:5140] mono_runtime_invoke_array_checked
    39. 0x000007FEC9580254 (mono-2.0-bdwgc) [icall.c:3358] ves_icall_InternalInvoke
    40. 0x000000003B181F56 (Mono JIT Code) (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&)
    41. 0x000000003B18055B (Mono JIT Code) System.Reflection.MonoMethod:Invoke (object,System.Reflection.BindingFlags,System.Reflection.Binder,object[],System.Globalization.CultureInfo)
    42. 0x000000001A5C0A1F (Mono JIT Code) System.Reflection.MethodBase:Invoke (object,object[])
    43. 0x0000000036335803 (Mono JIT Code) [HostView.cs:345] UnityEditor.HostView:Invoke (string,object)
    44. 0x0000000036335663 (Mono JIT Code) [HostView.cs:340] UnityEditor.HostView:Invoke (string)
    45. 0x000000004358D6E3 (Mono JIT Code) [HostView.cs:140] UnityEditor.HostView:OldOnGUI ()
    46. 0x0000000010F53071 (Mono JIT Code) [IMGUIContainer.cs:278] UnityEngine.UIElements.IMGUIContainer:DoOnGUI (UnityEngine.Event,UnityEngine.Matrix4x4,UnityEngine.Rect,bool,UnityEngine.Rect)
    47. 0x0000000010F5108B (Mono JIT Code) [IMGUIContainer.cs:483] UnityEngine.UIElements.IMGUIContainer:HandleIMGUIEvent (UnityEngine.Event,UnityEngine.Matrix4x4,UnityEngine.Rect)
    48. 0x000000004357CAC3 (Mono JIT Code) [IMGUIContainer.cs:464] UnityEngine.UIElements.IMGUIContainer:HandleIMGUIEvent (UnityEngine.Event)
    49. 0x0000000036314FD3 (Mono JIT Code) [IMGUIContainer.cs:444] UnityEngine.UIElements.IMGUIContainer:HandleEvent (UnityEngine.UIElements.EventBase)
    50. 0x0000000043576104 (Mono JIT Code) [MouseCaptureDispatchingStrategy.cs:89] UnityEngine.UIElements.MouseCaptureDispatchingStrategy:DispatchEvent (UnityEngine.UIElements.EventBase,UnityEngine.UIElements.IPanel)
    51. 0x000000003627A4A7 (Mono JIT Code) [EventDispatcher.cs:282] UnityEngine.UIElements.EventDispatcher:ProcessEvent (UnityEngine.UIElements.EventBase,UnityEngine.UIElements.IPanel)
    52. 0x0000000036273AEB (Mono JIT Code) [EventDispatcher.cs:157] UnityEngine.UIElements.EventDispatcher:Dispatch (UnityEngine.UIElements.EventBase,UnityEngine.UIElements.IPanel,UnityEngine.UIElements.DispatchMode)
    53. 0x0000000036273713 (Mono JIT Code) [Panel.cs:190] UnityEngine.UIElements.BaseVisualElementPanel:SendEvent (UnityEngine.UIElements.EventBase,UnityEngine.UIElements.DispatchMode)
    54. 0x000000003C36E963 (Mono JIT Code) [UIElementsUtility.cs:258] UnityEngine.UIElements.UIElementsUtility:DoDispatch (UnityEngine.UIElements.BaseVisualElementPanel)
    55. 0x000000003C36E0CB (Mono JIT Code) [UIElementsUtility.cs:78] UnityEngine.UIElements.UIElementsUtility:ProcessEvent (int,intptr)
    56. 0x000000003C36DA34 (Mono JIT Code) [GUIUtility.cs:179] UnityEngine.GUIUtility:ProcessEvent (int,intptr)
    57. 0x000000003C36DC53 (Mono JIT Code) (wrapper runtime-invoke) <Module>:runtime_invoke_bool_int_intptr (object,intptr,intptr,intptr)
    58. 0x000007FEC964BBCB (mono-2.0-bdwgc) [mini-runtime.c:2809] mono_jit_runtime_invoke
    59. 0x000007FEC95D2252 (mono-2.0-bdwgc) [object.c:2919] do_runtime_invoke
    60. 0x000007FEC95DB25F (mono-2.0-bdwgc) [object.c:2966] mono_runtime_invoke
    61. 0x000000014227B036 (Unity) scripting_method_invoke
    62. 0x0000000142275335 (Unity) ScriptingInvocation::Invoke
    63. 0x00000001422705AA (Unity) ScriptingInvocation::Invoke<bool>
    64. 0x000000013FA01C79 (Unity) Scripting::UnityEngine::GUIUtilityProxy::ProcessEvent
    65. 0x00000001409015EC (Unity) GUIView::ProcessRetainedMode
    66. 0x0000000140D64B6D (Unity) GUIView::OnInputEvent
    67. 0x00000001409014FC (Unity) GUIView::ProcessInputEvent
    68. 0x0000000140D66655 (Unity) GUIView::ProcessEventMessages
    69. 0x0000000140D5FC44 (Unity) GUIView::GUIViewWndProc
    70. 0x0000000076BC9BBD (USER32) TranslateMessageEx
    71. 0x0000000076BC98C2 (USER32) TranslateMessage
    72. 0x0000000140D63AEC (Unity) MainMessageLoop
    73. 0x0000000140D6D347 (Unity) WinMain
    74. 0x000000014369DD8E (Unity) __scrt_common_main_seh
    75. 0x0000000076CC556D (kernel32) BaseThreadInitThunk
    76. 0x0000000076E2385D (ntdll) RtlUserThreadStart
    77.  
    78.  
     
  7. luispedrofonseca

    luispedrofonseca

    Joined:
    Aug 29, 2012
    Posts:
    945
    I'm also trying to get the image tracking to work on iOS but no luck yet. Using Unity 2019.2b04 and the latest ARFoundation samples. Everything else works fine.

    Any hints @tdmowrer or @I_Jemin?
     
  8. luispedrofonseca

    luispedrofonseca

    Joined:
    Aug 29, 2012
    Posts:
    945
    @tdmowrer Would really appreciate some help here.
     
  9. PTW_AR

    PTW_AR

    Joined:
    Jan 13, 2019
    Posts:
    13
    If you get the same error code as me, would it be possible for you to provide the desired .txt-file (in my case: C:\Users\XXX\AppData\Local\Temp\4d676c83db4046c2bd0d68b010cd84ef\39344433fd8c4712b4ee109a5c73a2b2.txt) ?

    Apparently he misses some information to help us with that issue.
     
  10. luispedrofonseca

    luispedrofonseca

    Joined:
    Aug 29, 2012
    Posts:
    945
    @PTW_AR I'm on iOS and I get no error at all. It simply doesn't recognize any images.
     
  11. PTW_AR

    PTW_AR

    Joined:
    Jan 13, 2019
    Posts:
    13
  12. Fomin

    Fomin

    Joined:
    Dec 4, 2014
    Posts:
    9
    What version XCode are you using?
     
  13. Fomin

    Fomin

    Joined:
    Dec 4, 2014
    Posts:
    9
    I can not compile project in XCode 10.2, after update ARfoundation to 2.2.0 version and ARkit 2.2 version, in my project I use only 2D image Tracking, Is there any solution to this problem? upload_2019-6-9_15-23-14.png
     
  14. PTW_AR

    PTW_AR

    Joined:
    Jan 13, 2019
    Posts:
    13
    I don't think that's the right place for your problem. Anyway, I will give it a try:

    You will need iOS 13 and XCode 11 in order to get it onto your iOS-device. I'm working with a Android device right now, so I haven't used XCode yet.
     
  15. Fomin

    Fomin

    Joined:
    Dec 4, 2014
    Posts:
    9
    the solution to my problem is update ARfoundation to 2.2.0 but do not update ARkit XR 2.2.0, I did downgrade to ARKit to 2.1.0 and after that everything worked!
     
    Last edited: Jun 9, 2019
  16. Wim-Wouters

    Wim-Wouters

    Joined:
    Sep 26, 2012
    Posts:
    36
    Also doesn't work if .PNG extension is in CAPS. Changes to lowercase and now it seems to build.
     
  17. tdmowrer

    tdmowrer

    Joined:
    Apr 21, 2017
    Posts:
    605
    For ARCore or ARKit or both?

    Edit: I tested building both ARCore and ARKit from a Mac and they both complain that .PNG is not a valid extension. ARKit still recognizes the image at runtime, so it appears safe to ignore the Xcode warning. ARCore, however, will not generate the image database at all. I see what we can do in ARFoundation to work around this limitation.
     
    Last edited: Oct 6, 2019
    miranoren likes this.
  18. tdmowrer

    tdmowrer

    Joined:
    Apr 21, 2017
    Posts:
    605
    Apologies; I missed your plea for help. If you're still having issues, please let me know the exact version of Unity, ARFoundation package, ARKit XR Plugin package, iOS, and Xcode.
     
    clayton_axel likes this.
  19. clayton_axel

    clayton_axel

    Joined:
    Dec 4, 2018
    Posts:
    3
    Make sure your image target is at least 300 x 300 pixels. The file extension should be .png preferably. If it is .jpeg avoid heavy compression for best performance.
     
    Deven_19 likes this.
  20. mbshaikh19

    mbshaikh19

    Joined:
    Mar 27, 2017
    Posts:
    2
    This worked for me on ARFoundation 3.1.0
     
  21. codemaker2015

    codemaker2015

    Joined:
    Aug 19, 2018
    Posts:
    27
    It's happened due to the low-quality score of the image. ARCore reference image library accepts images of type .png and .jpg only. Also, It shows to have a quality score.
    First, we have to check the quality score of the image using arcoreimg tool
    We can download it from https://raw.githubusercontent.com/g.../master/tools/arcoreimg/windows/arcoreimg.exe
    Refer the following link to check the quality score https://developers.google.com/ar/develop/c/augmented-images/arcoreimg
    If the quality score is greater than 10 then you can create a database using that image
    otherwise, try another one.

    https://github.com/codemaker2015/ARFoundation-Image-Database-Demo
     
    r3b00t20 likes this.
  22. codemaker2015

    codemaker2015

    Joined:
    Aug 19, 2018
    Posts:
    27
    It's happened due to the low-quality score of the image. ARCore reference image library accepts images of type .png and .jpg only. Also, It shows to have a quality score.
    First, we have to check the quality score of the image using arcoreimg tool
    We can download it from https://raw.githubusercontent.com/g.../master/tools/arcoreimg/windows/arcoreimg.exe
    Refer the following link to check the quality score https://developers.google.com/ar/develop/c/augmented-images/arcoreimg
    If the quality score is greater than 10 then you can create a database using that image
    otherwise, try another one.

    https://github.com/codemaker2015/ARFoundation-Image-Database-Demo
     
  23. SushiRoll53

    SushiRoll53

    Joined:
    Mar 30, 2020
    Posts:
    6
  24. Wash3d

    Wash3d

    Joined:
    Mar 10, 2015
    Posts:
    6
    Guys the solution is to fixing the size of your produced image it must be width x hight =
    equal to integer not float number! Try to do this!
     
  25. AlexDraco

    AlexDraco

    Joined:
    Jun 27, 2018
    Posts:
    1
    Fixed by changing the image I had added to my 'ReferenceImageLibrary' for a qr code to test it. Im assuming not enough detail on the first image, idk, qr code worked fine.

    This was the error I was getting when trying to build and run for android:
    -Failed to generated ARCore reference image library 'ReferenceImageLibrary' ...
    -BuildFailedException: Failed to generate image database. Output from arcoreimg: ...

    These are the versions I was using:
    -AR Foundation3.0.1
    -AR Sybsystems 3.0.2
    -ARCore XR Plugin 3.0.1
     
  26. lraul

    lraul

    Joined:
    Jun 23, 2020
    Posts:
    3
    I have been doing some tests with several images, my closest guess thus far is that the photo should not have very deep blacks, otherwise it causes error.

    Im using unity 2019.4.1f0 LTS.

    Maybe give it shot
     
  27. HisDarkHumour

    HisDarkHumour

    Joined:
    Aug 23, 2017
    Posts:
    3
    @tdmowrer
    Hi, ARKit now offers
    var automaticImageScaleEstimationEnabled: Bool
    in its ARWorldTrackingConfiguration
    Can we/is it possible to enable this to allow us to set the image size, for variable sized tracking images?
    Thanks.
     
  28. Siggytron

    Siggytron

    Joined:
    Feb 9, 2018
    Posts:
    12
    That's so weird. I'll have to try it.

    Edit: That wasn't the issue oh well.
     
    Last edited: Nov 16, 2020
  29. Siggytron

    Siggytron

    Joined:
    Feb 9, 2018
    Posts:
    12
    Okay so what worked for me was to save the image with a greater pixel size. I noticed that the images my app would accept during a build all had more pixels in width and height compared to the image that my app would NOT accept during a build. I went back to my little graphic program and saved the same image at around 450 x 500 pixels and it worked.

    My already working images were all around 1000 pixels in at least one dimension but apparently I didn't need to go that high. I went from an image around 200 x (whatever) to around 450 x 500 and that was sufficient.