I am working with the ARToolKit sample app ARSimple on Android. Instead of having it track the hiro marker, I want to track an NFT marker. So I am using:
int testMarker = ARToolKit.getInstance().addMarker("2d;data/nft/Test.jpg");
According to the documentation, that is the right way to add an NFT marker (unless I've missed something).
This gives the following output:
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.
Which would appear to suggest it is not the right way to do it. So how do I add an NFT marker?
Edit:
With the changes from Thor_Bux's answer applied, my code becomes:
public boolean configureARScene() {
pinballMarker = ARToolKit.getInstance().addMarker("nft;data/pinball");
if (pinballMarker == -1) return false;
return true;
}
The files pinball.fset
, pinball.fset3
and pinball.iset
are located in my assets/Data
directory.
Error message is now the following:
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.
Edit:
After uninstalling the app, like Thor_Bux suggested, and changing the configuration to nft;Data/pinball
, the marker loads. But there is still an error message:
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.
Even though the marker appears to have loaded successfully it is not detected with queryMarkerVisible()
. Furthermore it seems SimpleRenderer#draw()
is never called despite the scene being configured successfully.
from the previous conversation it looks like you are working with this example code and want to change this line of code to make it track NFT markers: https://github.com/artoolkitx/artoolkit5/blob/master/AndroidStudioProjects/ARSimpleProj/aRSimple/src/main/java/org/artoolkit/ar/samples/ARSimple/SimpleRenderer.java#L72
You also state that you already created the needed NFT .fset and .iset files as described here: https://archive.artoolkit.org/documentation/doku.php?id=3_Marker_Training:marker_nft_training
What you now need to do is to add the fset and iset files into the 'assets/Data/' directory of your project. (Right next to the hiro.patt)
Then you change the mentioned line of code to this:
nft;data/pinball
Which is documented here:
and
https://github.com/artoolkitx/artoolkit5/blob/master/lib/SRC/ARWrapper/ARMarker.cpp#L239
Hope that helps