3D development -AR.js picture matching

Picture matching mode

    Load a picture as the recognition of pattern marker.

Code

AR.js / three.js / examples / marker-training / examples / patternmarker-from-image.html modify the code

// Load matching patterns from images

        // load image and convert it to a marker

        was ImageUrl = '../../res/arjs/marker/inner/inner-letterA.png';

        THREEx.ArPatternFile.encodeImageURL(imageURL, function onComplete(patternFileString) {

            var patternURL = 'data:text/plain;base64,' + btoa(patternFileString)

            // create THREEx.ArMarkerControls

            var markerControls = new THREEx.ArMarkerControls(arToolkitContext, markerRoot1, {

                type: 'pattern',

                patternUrl: patternURL,

//                patternUrl : "../../res/arjs/data/pattern-letterA.patt",

            })

        })

 

Guess you like

Origin www.cnblogs.com/zhen-android/p/11032730.html