Instance Property


A set of images that ARKit attempts to detect in the user's environment.


var detectionImages: Set<ARReferenceImage>! { get set }


Use this property to define known 2D images so ARKit can find them in the user's environment and present as ARImageAnchor for use in your AR experience. Use an Xcode asset catalog to provide reference images for ARKit to detect, or define them programmatically with the ARReferenceImage class.

ARKit has two ways to recognize images from this set during a session:

  • With image detection, ARKit reports when it first detects an image in view of the camera, and provides infrequent updates to the image anchor's transform thereafter. Image detection doesn't continuously track real-world movement of the image or track when the image disappears from view. It works best for cases where AR content responds to static images in the scene—for example, identifying art in a museum or adding animated elements to a movie poster.

  • In iOS 12.0 or later, set the maximumNumberOfTrackedImages to enable image tracking. Image tracking provides continuous updates for detected images that move relative to the world, and can accurately track when images disappear from view (or reappear afterward). Image tracking is well suited to cases where AR content responds to images on moving objects—for example, adding interactive characters to a tabletop card or board game.

Performance Considerations

Image detection accuracy and performance are reduced with larger numbers of detection images. For best results, use no more than around 25 images in this set.

You can support a larger total number of detection images by changing which set of images is active for detection over time. For example, an app that identifies paintings in an art museum might limit the set of detection images based on which area of the museum the user is currently in (after using Core Location to locate the user within the museum).

To detect a different set of images without otherwise affecting the session, call the session's run(_:options:) method with a configuration that contains a different detectionImages set and no options.

See Also

Enabling Image Detection or Tracking

var maximumNumberOfTrackedImages: Int

The maximum number of detection images for which to simultaneously track movement.

var automaticImageScaleEstimationEnabled: Bool

A flag that instructs ARKit to estimate and set the scale of a detected or tracked image on your behalf.