GuidesReferenceIssuesSupportGet API Key

Image Recognition

Image recognition is a key component of AR: it enables you to interpret the real world and respond to it accordingly. This guide provides an overview of Viro's image recognition capabilities.

Image Targets

Image targets are the reference images that Viro will recognize and track. For example, if you provide an image target of a Tesla logo, then every time your application encounters a Tesla logo you can get a callback; and in that callback, you can create virtual UI about the logo. An example of this is below:

Image targets in Viro are represented by ARImageTarget. You can construct an ARImageTarget out of any Bitmap. To start searching for the logos, add them to your ARScene with ARScene.addARImageTarget(ARImageTarget). When Viro detects the image in the user's world, you will receive an onAnchorFound(ARAnchor, ARNode) callback in your attached ARListener. You can then go ahead and add content to the provided ARNode, which will continually track and stay synchronized with the detected image.

In the example below, we do this with a "Black Panther" movie poster. Upon detecting the poster, we load a 3D object representing the Black Panther, and make him jump out of the poster.

// Create the base ARScene
Scene scene = new ARScene();

// Create an ARImageTarget out of the Black Panther poster
Bitmap blackPantherPoster = getBitmapFromAssets("poster.jpg");
final ARImageTarget imageTarget = new ARImageTarget(blackPantherPoster, ARImageTarget.Orientation.Up, 0.188f);

// Create a Node containing the Black Panther model
final Object3D blackPantherModel = loadBlackPantherModel();
final Node blackPantherNode = loadBlackPantherNode(blackPantherModel);

// Set an ARScene.Listener to get a callback when the poster is found
scene.setListener(new ARScene.Listener() {
    public void onAnchorFound(ARAnchor anchor, ARNode arNode) {
        String anchorId = anchor.getAnchorId();
        // Ensure the image target Viro found is our poster
        if (!imageTarget.getId().equalsIgnoreCase(anchorId)) {

        // Push the panther down and a little bit into the poster
        blackPantherNode.setPosition(new Vector(0, -0.4, -0.15));

    public void onAnchorRemoved(ARAnchor anchor, ARNode arNode) {
        String anchorId = anchor.getAnchorId();
        if (!imageTarget.getId().equalsIgnoreCase(anchorId)) {
    // Other ARScene.Listener methods are no-ops
        // ...

The full code for this sample is contained in the ViroCore Samples repository. The final result will look like this: