3D开发-AR.js 图片匹配

图片匹配方式

    加载一张图片作为识别的pattern marker。

代码

AR.js/three.js/examples/marker-training/examples/patternmarker-from-image.html修改代码

//从图片加载匹配模式

        // load image and convert it to a marker

        var 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",

            })

        })

 

posted @ 2019-06-16 20:15  zhen-Android  阅读(768)  评论(0编辑  收藏  举报