- Home /
Can I integrate custom image tracking with AR Foundation?
Hi there!
I have a use case where I want to use a QR code as a reference image for tracking (preferrably within AR Foundation). The catch is, that the exact content of the QR code is not known in advance, so I can't just add it as a reference image. Nevertheless, my QR code scanning library is pretty much able to precisely locate all four corners of the code on the 2D camera image in real time. I also know the physical size of the qr code.
Given this information, is there a way (ideally platform independent) to calculate the location and orientation of the code in 3D, so that I can place virtual content on it?
Thank you!
Edit: So, I ended up writing a plugin for this. If you are facing a similar issue, you may want to have a look ;)
Hey @jaben72 ,
Even I am looking for something similar. Did you find a way around this? Thanks.
Hi @sidbhise! I am actually working on a solution for this right now. $$anonymous$$aking pretty good progress. If you want to, you can P$$anonymous$$ me in the forum and we can collect some requirements :)
Answer by KirillKuzyk · Jul 23, 2020 at 07:58 AM
Yes, ARCore and ARKit support adding images at runtime. https://docs.unity3d.com/Packages/com.unity.xr.arfoundation@3.0/api/UnityEngine.XR.ARFoundation.MutableRuntimeReferenceImageLibraryExtensions.html#UnityEngine_XR_ARFoundation_MutableRuntimeReferenceImageLibraryExtensions_ScheduleAddImageJob_MutableRuntimeReferenceImageLibrary_Texture2D_System_String_System_Nullable_System_Single__JobHandle_
Here an example:
if (trackedImageManager.descriptor.supportsMutableLibrary) {
var mutableLib = trackedImageManager.referenceLibrary as MutableRuntimeReferenceImageLibrary;
var imageWidth = 0.05f;
mutableLib.ScheduleAddImageJob(texture, "image_name", imageWidth);
}
Thank you for your answer, but did you ever succeed in doing this with QR codes? When I tried this with ARCore as a backend, my QR codes would always get rejected as reference images, likely due to their lack of unique distinguishable features I suppose.
Your answer
Follow this Question
Related Questions
How to determine AR Tracked Object Bounds (AR Foundation)? 0 Answers
Unity ARCore model rendering 0 Answers
Object tracking with AR foundation not working 0 Answers
AR Foundation, Image target library size 1 Answer
How to track large buildings using Vuforia (or similar Augmented Reality Extension)? 1 Answer