使用AR.js进行图像跟踪-自定义图像描述符存在问题

时间:2020-04-07 11:03:01

标签: augmented-reality aframe ar.js

我正在尝试使用基于tutorial in AR.js documentation的“图像跟踪”来生成AR场景。当我使用Codepen demo中提供的示例URL时,它可以工作,但是当我将该URL指定为本地计算机中自己生成的图像描述符的路径时,出现此错误:

“在Worker 404上加载标记时出错”

由于当我使用演示中提供的图像描述符时效果很好,因此我认为这与我生成的图像描述符有关,实际上我也使用了演示中提供的相同image,因此我认为问题不在于标记的质量。

这是我的代码aframe-ar.html

<a-scene
      vr-mode-ui="enabled: false;"
      renderer="logarithmicDepthBuffer: true;"
      embedded
      arjs="trackingMethod: best; sourceType: webcam;debugUIEnabled: false;"
>
    <a-nft
      type="nft"
      url="../image_descriptors/test"
      smooth="true"
      smoothCount="10"
      smoothTolerance=".01"
      smoothThreshold="5"
    >
        <a-entity
              gltf-model='https://arjs-cors-proxy.herokuapp.com/https://raw.githack.com/AR-js-org/AR.js/master/aframe/examples/image-tracking/nft/trex/scene.gltf'
              scale="5 5 5"
              position="100 100 0"
        >
        </a-entity>
  </a-nft>
      <!-- static camera that moves according to the device movemenents -->
  <a-entity camera></a-entity>
</a-scene>

这是我的文件夹结构:

src 
  | -- image_descriptors
         | -- test.fset
         | -- test.fset3
         | -- test.iset
  | -- assets
         | -- aframe-ar.html

1 个答案:

答案 0 :(得分:0)

我使用XAMPP对其进行了测试。我不知道为什么,但是如果您看到控制台,就会看到日志

基本路径:http://localhost:8080

所以我尝试了

<a-nft
    type="nft"
    url="test/image_descriptors/test"
    smooth="true"
    smoothCount="10"
    smoothTolerance=".01"
    smoothThreshold="5">

具有以下文件夹结构:

htdocs (basically http://localhost:8080)
| -- test
     | -- image_descriptors
          | -- test.fset
          | -- test.fset3
          | -- test.iset
     | -- assets
          | -- aframe-ar.html

它有效