This page concerns the Vuforia Engine API version 9.8 and earlier. It has been deprecated and will no longer be actively updated. We recommend migrating to the Vuforia Engine 10 API before this page is removed in February 2022. The equivalent of this page or topic can be found here: Image Targets Optimization Techniques.
In this article, we introduce different techniques for improving your image-based targets by evaluating and adjusting the contrasts and other settings on the device that may impact tracking performance.
We present a series of adjustments and different techniques to help you improve low performance image-based targets. Image Targets are tracked based on their natural features which can be enhanced through the contrast settings.
Additionally, if you experience that the environment or device also impacts the tracking robustness, it may be necessary to define the camera’s focus mode and other device settings.
Evaluate a Target Image in Grayscale
Vuforia Engine uses the grayscale version of your target image to identify features that can be used for recognition and tracking. You can use the grayscale histogram of your image to evaluate its suitability as a target image. Grayscale histograms can be generated using an image editing application, such as GIMP or Photoshop.
If the image has low overall contrast and the histogram of the image is narrow and spiky, it is not likely to be a good target image. These factors indicate that the image does not present many usable features. However, if the histogram is wide and flat, this is a good first indication that the image contains a good distribution of useful features. Note, though, that this is not true in all cases, as demonstrated by the image with gradient features.
Good or bad local contrast is often difficult to detect with your eye. You can improve the contrast of the image by enhancing the features' edges as demonstrated in the example below. Other general features such as organic shapes, round details, blurred, or highly compressed images often do not provide enough richness and detail to be detected and tracked properly. See Best Practices for Designing and Developing Image Targets for more information.
Local Contrast Enhancement
If the evaluation or star rating of your Image Target resulted in insufficient features, we recommend enhancing the contrast as a way of improving target detection. This will improve the quality of the features by applying a local contrast enhancement adjustment on the image.
This adjustment modifies the image by increasing the local contrast across edges and around the corners. For this adjustment to yield the expected result, the printed target must be sharp, and the camera focus must be set correctly in the application at runtime. Otherwise, camera blur can diminish the effect of this adjustment. See Camera focus modes on how to adjust this setting.
NOTE: If you downscale the image on the longer side in the Target Manager it can destroy the effect of this adjustment; it is therefore important to scale down the image before this step.
The procedure to apply this adjustment is fairly simple. In our example, we use Adobe Photoshop. You can use any other graphic editor tool of your choice; however, the steps may differ:
- 1. Load the image into Adobe Photoshop.
- 2. Convert the layer into a Smart Object.
- 3. Select Filter->Sharpen->Unsharp Mask and adjust the three settings (Amount, Radius, and Threshold) to enhance the contrast.
NOTE: The Amount and Radius settings are interdependent, meaning that if you raise the Radius, you’ll need to lower the Amount, and vice versa.
- Amount controls the contrast applied to the edges. For high resolution images, the Amount should not exceed 200%.
- Radius control the thickness of the edges. Increasing by 1 pixel will affect one light pixel and one dark pixel alongside the edges of the features. For printed images, it is recommended to stay within 1-3 pixels to avoid halo effects.
- Threshold controls which pixels are affected by the two other settings. Its range, 0-255, are the brightness levels and indicate to what level the surrounding pixels would be sharpened. It much depends on how well the image details stand out from the background in your image, but it is recommended to keep the threshold setting at 10 or below.
The output is an image with enhanced contrast. If you wish to see more on image correction after contrast enhancement, please refer to your image editing tool’s own resources and the various guides available such as this one.
Image with enhanced local contrast
Device and Camera Adjustments
If the target is not focused well in the camera view, the camera image result can be blurry, and the target details can be hard to detect. As a consequence, detection and tracking performance can be negatively affected.
It is recommended to make use of the appropriate Camera Focus Mode to ensure the best camera focus conditions. For a complete description of camera focus modes, See: Camera Focus Modes
The lighting conditions in your test environment can significantly affect target detection and tracking.
- Make sure that there is enough light in your room or operating environment so that the scene details and target features are well visible in the camera view.
- Consider that Vuforia Engine works best in indoor environments, where the lighting conditions are usually more stable and easier to control.
- If your application use case and scenarios require operating in dark environments, consider enabling the device Flash torch (if your device has one), using the
CameraDevice.getInstance().setFlashTorchMode( true );
or in Unity:
CameraDevice.Instance.SetFlashTorchMode( true );
We also recommend considering what material the target image will be placed on as glossiness and flatness can affect its trackability. Please consult the Physical Properties of Image-Based Targets for more information.
If you experience that your augmentations disappear at a certain distance from the Image Target, it may be that your far clipping plane (in OpenGL or in the Unity camera settings) is needed to be adjusted. This applies especially if you work with large Image Targets.
Increase the value of your far distance clipping plane as suggested in the OpenGL samples.
projectionMatrix = Tool.getProjectionGL(camCalibration, near_distance, far_distance);
or (C++, Android/iOS)
rojectionMatrix = Vuforia::Tool::getProjectionGL(cameraCalibration, near_dist, far_dist);
In Unity, the near and far clipping planes can be set directly in the ARCamera GameObject's Inspector Window.
TIP: You can also empover tracking capabilities of a target if it is barely visible or even out of sight by using Device Tracking.