ARToolKit - 无法添加NFT标记,未知标记类型

时间:2018-01-08 11:17:14

标签: java android artoolkit

我正在使用Android上的ARToolKit示例应用程序ARSimple。我没有跟踪hiro标记,而是想跟踪NFT标记。所以我正在使用:

int testMarker = ARToolKit.getInstance().addMarker("2d;data/nft/Test.jpg");

根据文档,这是添加NFT标记的正确方法(除非我错过了某些内容)。

这给出了以下输出:

E/libARWrapper: ARController (native): [error]Error: Unknown marker type '2d' in config '2d;data/nft/Test.jpg'.
E/libARWrapper: ARController (native): [error]Error: Failed to load marker.

这似乎表明这不是正确的方法。那么如何添加NFT标记?

修改

应用Thor_Bux的答案后,我的代码变为:

public boolean configureARScene() {
    pinballMarker = ARToolKit.getInstance().addMarker("nft;data/pinball");

    if (pinballMarker == -1) return false;

    return true;
}

文件pinball.fsetpinball.fset3pinball.iset位于我的assets/Data目录中。

现在出现以下错误消息:

E/libar: Error: unable to open file 'data/pinball.iset' for reading.
E/libar: Error opening file 'data/pinball.iset'.
E/libARWrapper: ARController (native): [error]Error reading data from data/pinball.fset
E/libARWrapper: ARController (native): [error]Error: Failed to load marker.

修改

卸载应用程序后,如Thor_Bux建议,并将配置更改为nft;Data/pinball,标记会加载。但仍有错误信息:

E/libARWrapper: ARController (native): [error]Loading Data/pinball.fset.
I/libar: ### Surface No.1 ###
I/libar:   Read ImageSet.
I/libar: Imageset contains 8 images.
D/Camera-JNI: Using callback buffer from queue of length 9
D/Camera-JNI: Using callback buffer from queue of length 8
D/Camera-JNI: Using callback buffer from queue of length 7
D/Camera-JNI: Using callback buffer from queue of length 6
D/Camera-JNI: Using callback buffer from queue of length 5
D/Camera-JNI: Using callback buffer from queue of length 4
D/Camera-JNI: Using callback buffer from queue of length 3
D/Camera-JNI: Using callback buffer from queue of length 2
D/Camera-JNI: Using callback buffer from queue of length 1
D/Camera-JNI: Out of buffers, clearing callback!
I/libar:     end.
I/libar:   Read FeatureSet.
I/libar:     end.
E/libARWrapper: ARController (native): [info]First NFT marker added; enabling NFT marker detection.
E/libARWrapper: ARController (native): [info]Added marker (UID=0), total markers loaded: 1.

即使标记似乎已成功加载,也不会使用queryMarkerVisible()检测到。此外,尽管场景配置成功,但似乎永远不会调用SimpleRenderer#draw()

1 个答案:

答案 0 :(得分:1)

从上一个对话中看起来您正在使用此示例代码,并希望更改此行代码以使其跟踪NFT标记: https://github.com/artoolkitx/artoolkit5/blob/master/AndroidStudioProjects/ARSimpleProj/aRSimple/src/main/java/org/artoolkit/ar/samples/ARSimple/SimpleRenderer.java#L72

您还声明已经创建了所需的NFT .fset和.iset文件,如下所述:https://archive.artoolkit.org/documentation/doku.php?id=3_Marker_Training:marker_nft_training

您现在需要做的是将fset和iset文件添加到" assets / Data /'项目目录。 (就在hiro.patt旁边)

然后将上面提到的代码行更改为: nft;data/pinball 这里记录了:

https://github.com/artoolkitx/artoolkit5/blob/master/AndroidStudioProjects/ARBaseLibProj/aRBaseLib/src/main/java/org/artoolkit/ar/base/ARToolKit.java#L303

https://github.com/artoolkitx/artoolkit5/blob/master/lib/SRC/ARWrapper/ARMarker.cpp#L239

希望有所帮助