我正在使用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()

最佳答案

从上一个对话中,您似乎正在使用此示例代码,并且想要更改此行代码以使其跟踪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

希望能有所帮助

07-27 16:26