function onRecognitionFn(recognized, response) {
        if (recognized) {
            /* Clean Resources from previous recognitions. */
            if (World.wineLabel !== undefined) {
                World.wineLabel.destroy();
            }

            if (World.wineLabelOverlay !== undefined) {
                World.wineLabelOverlay.destroy();
            }

            /*
                To display the label of the recognized wine on top of the previously created banner, another
                overlay is defined. From the response object returned from the server the 'targetInfo.name' property
                is read to load the equally named image file. The zOrder property (defaults to 0) is set to 1 to
                make sure it will be positioned on top of the banner.
            */
            World.wineLabel = new AR.ImageResource("assets/" + response.targetInfo.name + ".jpg", {
                onError: World.onError
            });
            World.wineLabelOverlay = new AR.ImageDrawable(World.wineLabel, 0.3, {
                translate: {
                    x: -0.5,
                    y: -0.6
                },
                zOrder: 1
            });

            if (World.wineLabelAugmentation !== undefined) {
                World.wineLabelAugmentation.destroy();
            }

            /*
                The following combines everything by creating an AR.ImageTrackable using the
                CloudRecognitionService, the name of the image target and the drawables that should augment the
                recognized image.
            */
            World.wineLabelAugmentation = new AR.ImageTrackable(World.tracker, response.targetInfo.name, {
                drawables: {
                    cam: [World.bannerImgOverlay, World.wineLabelOverlay]
                },
                onError: World.error
            });

            World.hideInfoBar();
        } else {
            /* Image recognition failed. An error message will be displayed to the user. */
            document.getElementById('errorMessage').innerHTML =
                "<div class='errorMessage'>Recognition failed, please try again!</div>";

            setTimeout(function() {
                var e = document.getElementById('errorMessage');
                e.removeChild(e.firstChild);
            }, 3000);
        }
    }
/*
        The onRecognition callback function defines two parameters. The first parameter is a boolean value which
        indicates if the server was able to detect the target, it's value will be 0 or 1 depending on the outcome.
        The second parameter a JSON Object will contain metadata about the recognized target, if no target was
        recognized the JSON object will be empty.
    */
The onRecognition callback function defines two parameters. The first parameter is a boolean value which
indicates if the server was able to detect the target, it's value will be 0 or 1 depending on the outcome.
The second parameter a JSON Object will contain metadata about the recognized target, if no target was
recognized the JSON object will be empty.
The onRecognition callback function defines two parameters . The first parameter is a boolean value which indicates if the server was able to detect the target it ' s value will be 0 or 1 depending on the outcome . The second parameter a JSON Object will contain metadata about the recognized target if no target was recognized the JSON object will be empty .
function onRecognitionFn(recognized, response) {
        if (recognized) {
            if (World.wineLabel !== undefined) {
                World.wineLabel.destroy();
            }
            if (World.wineLabelOverlay !== undefined) {
                World.wineLabelOverlay.destroy();
            }
            World.wineLabel = new AR.ImageResource("assets/" + response.targetInfo.name + ".jpg", {
                onError: World.onError
            });
            World.wineLabelOverlay = new AR.ImageDrawable(World.wineLabel, 0.3, {
                translate: {
                    x: -0.5,
                    y: -0.6
                },
                zOrder: 1
            });
            if (World.wineLabelAugmentation !== undefined) {
                World.wineLabelAugmentation.destroy();
            }
            World.wineLabelAugmentation = new AR.ImageTrackable(World.tracker, response.targetInfo.name, {
                drawables: {
                    cam: [World.bannerImgOverlay, World.wineLabelOverlay]
                },
                onError: World.error
            });
            World.hideInfoBar();
        } else {
            document.getElementById('errorMessage').innerHTML =
                "<div class='errorMessage'>Recognition failed, please try again!</div>";
            setTimeout(function() {
                var e = document.getElementById('errorMessage');
                e.removeChild(e.firstChild);
            }, 3000);
        }
    }
function onRecognitionFn ( recognized , response ) { if ( recognized ) { if ( World . wineLabel !== undefined ) { World . wineLabel . destroy ( ) ; } if ( World . wineLabelOverlay !== undefined ) { World . wineLabelOverlay . destroy ( ) ; } World . wineLabel = new AR . ImageResource ( "assets/" + response . targetInfo . name + ".jpg" , { onError : World . onError } ) ; World . wineLabelOverlay = new AR . ImageDrawable ( World . wineLabel , 0.3 , { translate : { x : - 0.5 , y : - 0.6 } , zOrder : 1 } ) ; if ( World . wineLabelAugmentation !== undefined ) { World . wineLabelAugmentation . destroy ( ) ; } World . wineLabelAugmentation = new AR . ImageTrackable ( World . tracker , response . targetInfo . name , { drawables : { cam : [ World . bannerImgOverlay , World . wineLabelOverlay ] } , onError : World . error } ) ; World . hideInfoBar ( ) ; } else { document . getElementById ( 'errorMessage' ) . innerHTML = "<div class='errorMessage'>Recognition failed, please try again!</div>" ; setTimeout ( function ( ) { var e = document . getElementById ( 'errorMessage' ) ; e . removeChild ( e . firstChild ) ; } , 3000 ) ; } }
The onRecognition callback function defines two parameters.
The onRecognition callback function defines two parameters .
/* Clean Resources from previous recognitions. */ /*
                To display the label of the recognized wine on top of the previously created banner, another
                overlay is defined. From the response object returned from the server the 'targetInfo.name' property
                is read to load the equally named image file. The zOrder property (defaults to 0) is set to 1 to
                make sure it will be positioned on top of the banner.
            */ /*
                The following combines everything by creating an AR.ImageTrackable using the
                CloudRecognitionService, the name of the image target and the drawables that should augment the
                recognized image.
            */ /* Image recognition failed. An error message will be displayed to the user. */