Image tracking with ARKit

Ivan Nesterenko
Krootl
Published in
2 min readJun 21, 2018
Real-time object tracking at its finest

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 ARImageTrackingConfiguration. 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 ARReferenceImages to your session configuration and run it.

Creating ARImageTrackingConfiguration

You can also configure the number of images that would be tracked simultaneously like this:

configuration.maximumNumberOfTrackedImages = 2

And that’s it. As you can see the image tracking API of the ARKit is really straightforward and easy to use.

***

In some casesARWorldConfiguration 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 ARWorldConfiguration to recreate coordinates of the image’s movement. In fact, I have a huge post on this topic, check it out.

🖖

--

--