In this small post, I will provide an overview of image tracking in ARKit from the developer’s perspective together with some sample code.
To enable image tracking, you will need to set your ARSesion configuration to an [.c]ARImageTrackingConfiguration[.c]. ARImageTrackingConfiguration is a type of a session configuration created for standalone image tracking. It is preferable if you use only the image detection feature in your AR app.
In the example below, I place a cat gif on top of a tracked image. As you can see, image position updates are really smooth.
It is also needed to add a set of [.c]ARReferenceImages[.c] to your session configuration and run it.
You can also configure the number of images that would be tracked simultaneously by changing [.c]configuration.maximumNumberOfTrackedImages[.c]
And that’s it. As you can see the image tracking API of the ARKit is really straightforward and easy to use.
In some cases [.c]ARWorldConfiguration[.c] still doesn’t update image position too frequently, which means that you can’t use image tracking together with other ARKit features. To solve this one can fake image tracking by using linear interpolation and position updates from [.c]ARWorldConfiguration[.c] to recreate coordinates of the image’s movement. In fact, I have a huge post on this topic, check it out.