Targets

How many targets can be recognized and tracked by a Vuforia app?

The number of targets that your app can recognize and track simultaneously will depend on the types of databases that you utilize and also the target types.

Image Targets

Vuforia supports both local and online target databases for Image Targets. These are referred to as device and cloud databases respectively, See: Comparison of Device and Cloud Databases

Device Databases

Device Databases are stored on the device with your app. You can load and unload Device Databases programmatically, and activate or deactivate them using the ObjectTracker API. Activating a loaded database enables Vuforia to detect any of the targets included in that database.

The number of targets that can be active simultaneously, across one or more loaded Device Databases, is constrained by the device context and its available resources.

Cloud Databases

Image Targets in Cloud Databases are recognized using the Cloud Recognition service. A single Cloud Database can contain up to 1 million Image Targets. When an image in your Cloud Database is recognized, it's associated Image Target is returned to your app. Cloud Recognition does not support simultaneous image tracking and Cloud Databases only support Image Targets.

Multi-targets

The same Device Database rules that apply to Image Targets also apply to Multi-Targets. Since a Multi-Target is made of up a combination of multiple Image Targets, the number of Image Targets in a Multi-Target determines its target count for the purpose of determining the Multi-Target capacity of a Device Database. For example, a cube or cuboid Multi-Target with six faces (6 Image Targets) is equivalent to six targets in a Device Database.

Object Targets

A single device database can contain up to 20 Object Targets. A maximum of 2 Object Targets can be tracked simultaneously.

Can I manually change the size in the dataset XML?

Yes, it is possible to edit the dataset XML file and change the target size manually. However, be aware that you should still take care of maintaining the original aspect ratio (width and height). For instance, if you make the width twice as large, you should also double the height.

What does the target size represent?

The target size represents the actual size of the target in meters. Do not get confused by the fact that it is a 2D size (width and height). This is because your image target is a flat rectangular 2D shape, but if you think of such a rectangle in 3D space (with some position and orientation), its width and height become actual 3D dimensions. Note that the third dimension (the thickness) is null and is not relevant simply because the target is a flat rectangle (it has no thickness).

What is the relationship between the image resolution (size in pixels) and the target size?

There is no direct relationship between these attributes. The target size represents the size of the target rectangle in meters. For example, if your image has a resolution of 1024 x 512 pixels, this does not mean that you have to enter 1024 as target width in the target manager.

The only indirect relationship between image size (pixels) and target size is the aspect ratio, so the target width/height ratio must be the same as the image width/height ratio.

What image resolution should I use for target images?

During the resizing process, anti-aliasing is performed on the uploaded image. This action is perfectly acceptable for photos, but the results may affect the detectability of Image Targets.

To avoid experiencing the anti-aliasing impact, you can ensure that the uploaded image is at least 320 pixels in width.
Stretching and softening in the image due to a server-side scaling step results in a lower feature count and worse local contrast in the image. This may not be visible immediately, but such targets can result in poor target detection and tracking.

What image file formats are supported for Image Targets?

The file must be 8 or 24-bit PNG or JPG. A JPG file must be RGB or greyscale. Maximum image file size is 2.25MB.

Can I change my target size programmatically?

If you want to change the size of your Image Targets at run time (programmatically using script code), and you want Vuforia to take into account the new size and change the tracked target distance accordingly, you need to:

  • use the ImageTarget.SetSize( Vector2 new_size ) API
  • Deactivate the Dataset before changing the size
  • Reactivate the Dataset after changing the size

This sample code shows how to check and set target sizes using the Vuforia API

public class TargetInfo : MonoBehaviour 
{
    void OnGUI()
    {
        StateManager sm = TrackerManager.Instance.GetStateManager();
        if (GUI.Button (new Rect(50,50,200,40), "Size Up"))
        {
            ImageTracker tracker = TrackerManager.Instance.GetTracker<ImageTracker>();
            foreach (DataSet ds in tracker.GetActiveDataSets())
            {
                // Deactivate Dataset before chaging the target size
                tracker.DeactivateDataSet(ds);
                foreach (Trackable trackable in ds.GetTrackables())
                {
                    if (trackable is ImageTarget) {
                        ImageTarget it = trackable as ImageTarget;
                        Vector2 old_size = it.GetSize(); 
                        Vector2 new_size = new Vector2(1.5f*old_size.x, 1.5f*old_size.y);
                        it.SetSize(new_size);
                    }
                }
                // Reactivate dataset
                tracker.ActivateDataSet(ds);
            }
        }
        
        foreach (TrackableBehaviour tb in sm.GetActiveTrackableBehaviours())
        {
            if (tb is ImageTargetBehaviour)
            {
                ImageTargetBehaviour itb = tb as ImageTargetBehaviour;
                float dist2cam = (itb.transform.position - Camera.main.transform.position).magnitude;
                ImageTarget it = itb.Trackable as ImageTarget;
                Vector2 size = it.GetSize();
                GUI.Box (new Rect(50,100,300,40), it.Name + " - " + size.ToString() + 
                         "\nDistance to camera: " + dist2cam);
            }
        }
    }
}

Should the target size match the physical size of the printed target?

Yes! The target size has to match the real (physical) size of the physical target, for example, the printed size of a paper board, sheet, or other physical support. A 20-centimeter wide printed target will have a width of 0.20.

What is the recommended physical target size for a given distance?

For tabletop, near-field, product shelf and similar scenarios, a physical printed image target should be at least 5 inches wide, or 12 cm, and of reasonable height for a good AR experience. However, the recommended size varies, based on the actual target rating and the distance to the physical image target.
In general, the higher the distance between the camera and the target, the larger your target should be. Obviously, smaller targets are suited for a close range AR experience, while larger targets are more suitable when the AR experience is expected at further distance from the target.

As an estimate, consider that a 20-30 cm wide target should be detectable up to about 2 – 3 meters distance, which is about 10 times the target size. However, be aware that this value is an empirical indication and the actual size/distance ratio may vary significantly depending on many factors, such as the following:

  • The lighting conditions of your environment
  • The device camera focus mode
  • The target rating (star rating: 1 to 5 stars)
  • The viewing angle (Is the camera facing the target directly or is the camera facing the target from a steep oblique angle?)

Why do my augmentations disappear beyond a certain distance?

This issue may be due to one of the following reasons:

  • The target is too small for operating at such distance
    • Suggestion: Consider increasing the size of your physical target.
  • The far clipping place (in OpenGL or in the Unity camera settings) is too small and is causing the 3D augmentation models to be clipped (not rendered)
    • Suggestion: Check and then possibly increase the value of your far distance clipping plane. In the OpenGL samples, this action is usually done with code that is similar to the following code:

JAVA (Android)

projectionMatrix = Tool.getProjectionGL(camCalibration, near_distance, far_distance);


or (C++, Android/iOS)

projectionMatrix = Vuforia::Tool::getProjectionGL(cameraCalibration, near_dist, far_dist);

In Unity, the near and far clipping planes can be set directly in the ARCamera inspector.


How To Detect and Track Multiple Targets Simultaneously

The maximum number of targets that can be tracked at the same time is determined by two factors:

  • The number of targets that can be detected in the device camera's field of view
  • The computational performance of the device.

The first factor relates to a target's physical size and the maximum distance from which a set of targets can be detected to maintain tracking. The greater the number of targets, the farther the camera needs to be from them to capture them all in its FoV. Eventually the necessary distance results in a loss of tracking because the features of the targets are not longer detectable.

The second factor is device-dependent. Target tracking is a computationally intensive process. Each device has an effective limit on the number of targets that it can track simultaneously while maintaining satisfactory performance of other tasks like screen rendering. Trying to track too many targets simultaneously will result in a poor user experience, due to a lowered rendering frame rate.

This is why the Vuforia SDK limits the maximum number of simultaneously tracked image-based targets to 5, and provides an API method that enables you to define a lower maximum for your app.

Vuforia.setHint( HINT_MAX_SIMULTANEOUS_IMAGE_TARGETS, how_many );

For instance, you can tell Vuforia to allow it to track up to 4 simultaneous image targets, by writing:

Vuforia.setHint( HINT_MAX_SIMULTANEOUS_IMAGE_TARGETS, 4 );

While in Unity, you can specify this request using the Max Simultaneous Image Targets property in the ARCamera prefabs settings (using the Inspector panel in the Unity Editor). You can also specify this request programmatically at run time using the following C# code:

VuforiaUnity.SetHint ( VuforiaHint.HINT_MAX_SIMULTANEOUS_IMAGE_TARGETS, 4 );

Note that this method has no effect when using the Cloud Recognition Target Finder because the Target Finder will only maintain one active target at a time.

Using Multiple Object Targets Simultaneously

The Vuforia SDK can track up to five Object Targets simultaneously. This feature can be enabled by providing hints to the Vuforia SDK. The Object Targets sample lets you turn on this feature by uncommenting two highlighted lines.

Unity

Use the Max Simultaneous Tracked Objects field in the VuforiaConfiguration asset which is accessible from the ARCamera's Inspector panel via the Open Vuforia Configuration button. You can also search for VuforiaConfiguration in the Project panel.

ANDROID - C++

The hint lines are in the native source file ObjectTargets.cpp

JNIEXPORT void JNICALLJava_com_vuforia_samples_ObjectTargets_ObjectTargets_
onQCARInitializedNative(JNIEnv *, jobject){   
// Comment in to enable tracking of up to 2 targets simultaneously:   
QCAR::setHint(QCAR::HINT_MAX_SIMULTANEOUS_IMAGE_TARGETS, 2);

Using Multiple Image Targets Simultaneously

The Vuforia SDK can track up to five Image Targets simultaneously. This feature can be enabled by providing hints to the Vuforia SDK. The Image Targets sample lets you turn on this feature by uncommenting two highlighted lines.

ANDROID - C++

The hint lines are in the native source file ImageTargets.cpp

JNIEXPORT void JNICALLJava_com_vuforia_samples_ImageTargets_ImageTargets_
onQCARInitializedNative(JNIEnv *, jobject){   
// Comment in to enable tracking of up to 2 targets simultaneously:   
QCAR::setHint(QCAR::HINT_MAX_SIMULTANEOUS_IMAGE_TARGETS, 2);

iOS - ObjectiveC

The hint is in the EAGLView.mm of the Image Target sample

-void postInitQCAR:{   
// Here we can make a QCAR::setHint call to set the maximum   
// number of simultaneous targets          
QCAR::setHint(QCAR::HINT_MAX_SIMULTANEOUS_IMAGE_TARGETS, 2);
}

Using Several Multi-Targets Simultaneously

You can enable simultaneous detection and tracking of multiple Multi-Targets by adding the following hints:

ANDROID - C++

A hint in the onQCARInitializedNative() method:

JNIEXPORT void JNICALLJava_com_vuforia_samples_MultiTargets_MultiTargets_
onQCARInitializedNative (JNIEnv *, jobject)
{    QCAR::setHint(QCAR::HINT_MAX_SIMULTANEOUS_IMAGE_TARGETS, 2);   
initMIT();  
QCAR::registerCallback(myUpdateCallBack);}

iOS - ObjectiveC

The corresponding section with the hint in the EAGLView.mm of the MultiTarget sample is:

-void postInitQCAR:{   
// Here we can make a QCAR::setHint call to set the maximum
// number of simultaneous targets    
QCAR::setHint(QCAR::HINT_MAX_SIMULTANEOUS_IMAGE_TARGETS, 2);
}

How To Edit the Properties of a Target

You can rename targets and update target source files within the Target Manager by following these steps.

Change the target source file for an existing target

Use this procedure to change the source file associated with an existing target in a Device Database. For Object Targets, the source file must be an Object Data file (*.od ) produced by the Vuforia Object Scanner. For Image targets, the source file must be a supported image file format. Changing the source file will have no effect on any target image already downloaded to a Device Database.

  1. Go to the Target Manager Home Page, you will see a list of existing Device Databases.
  2. Click the name of the Device Database containing the target.
  3. Click the name of the target in the target list.
Vuforia Image

You will be taken to the target details page. For Multi Targets and Cylinder Targets, you will need to click on the side of the target that you want to edit to get to that image's detail's page.

  1. Click the Update Target link, for Multi Target and Cylinder target side images, you'll use the Change link.
Vuforia Image

Click Update Target to change Object Targets and Image Target source files.

Vuforia Image

Click Change in the image details view for the target side that you want to change on Multi Targets and Cylinder Targets.

  1. Browse to select the new target source file and then press Done to upload the file.
Vuforia Image
  1. Your target will be updated with the new source file after a short processing interval.

Change the name of a target

Steps:

  1. Go to the Target Manager Home Page, you will see a list of existing Device Databases.
  2. Click the name of the Device Database containing the target.
  3. Click the name of the target in the target list.
  4. Click the Edit Name link above the target visualization.
Vuforia Image
  1. Define a new target name in the Edit Name dialog and click Save.

Best Practices for Large Device Databases

Vuforia can support device databases containing up to 1000 images. These images may be contained in a single database, or across multiple databases that are active at runtime.

While there is no restriction on the total number of targets that can active in your app at runtime, there are specific consideration to aware of when using large device databases.

This article describes performance considerations for working with large device databases and provides advice on best practices for using larger databases.

Considerations

  • Handling database load times

The load time for a device database will increase with the number of targets in the database. It's recommended that you test the load times for large databases to determine if they are satisfactory for your app's user experience. If the load times are too long, consider splitting the database into multiple smaller databases and loading those only when they are needed by your app.

  • Avoiding image confusion

Target images can be confused for each other if they contain very similar patterns and imagery. The potential for this occurring will increase with the number of active targets if your database(s) contain targets with a similar appearance.

Tip: If you find that two or more of your targets are being confused, use the Show Features view in the Target Manager to revise the target images so that each contains a sufficient proportion of original features.

  • Anticipate longer download times from the Target manager

The time that it takes to process and download a device database increases with the number of targets in the database. Be aware that it may take several minutes to download a large device database and up to 30 minutes to download one containing 1000 targets.

  • Performance differences across devices

Large device databases consume more memory and processing resources than smaller databases. These factors will result in a greater variability in performance between high and low end devices. It's recommended that you test your app, using your databases, on a representative sample of the low end devices that you are targeting.