androidartoolkit

Android ARToolKit - Changing the reference images in the NFT sample project?


I've been tinkering with ARToolKit and their sample Android Studio Projects to see which one I can modify for my purpose. I opened the nftBookProj, it's the one using the pinball.jpg and then places an animated propeller plane along with a 3D axis in the origin of the image.

I noticed that the nftBookProj/nftBook/src/main/assets/DataNFT/ directory had pinball.iset, pinball.fset, and pinball.fset3 files. I then made my own image (with definite features, high resolution, high dpi and all) and then using the methods specified in this tutorial, I created my own set of reference_1.iset, reference_1.fset, reference_1.fset3 files. I then placed those 3 files in the same folder where the pinball files are.

I then checked all the activites and classes to find out the lines I have to change to make the app reference my own reference files instead of the pinball ones. It wasn't in any of the classes but I found markers.dat file under the /assets/Data/ folder and it looked like this:

# Number of markers
1

# Entries for each marker. Format is:
#
# Name of pattern file (relative to this file)
# Marker type (SINGLE)
# Marker width in millimetres (floating point number)
# Optional tokens:
#     FILTER [x]   Enable pose estimate filtering for the preceding marker
#                  x (optional) specifies the cutoff frequency. Default
#                  value is AR_FILTER_TRANS_MAT_CUTOFF_FREQ_DEFAULT, which
#                  at time of writing, equals 5.0.
# A blank line

../DataNFT/pinball
NFT
FILTER 15.0

I then changed ../DataNFT/pinball to ../DataNFT/reference_1, compiled the project, ran it on my tablet.

However, when I ran the code, it wasn't reacting to the image I made and when I checked with the pinball image, it worked. This means that I wasn't able to fully change the image it would refer to.

I then triple checked all the classes I could but I couldn't see where it indicates there that the pinball image should be used. This dead end stumps me because I no longer know where to look.

Has anyone had luck in changing the reference image in ARToolKits NFTBookProj for Android?


Solution

  • Found it. In the nftBookApplication class, it says there that if the file(s) in the assets folder get changed, you should update the assets folder, you should also update the version code in the Manifest.

    If you aren't going to upload the app to the google play store, you can just update the one on the manifest AND remove the versionCode and versionName lines in the build gradle file. If you don't, the version info in the gradle file will always override the one in the manifest. Well you can also use the version codes in the gradle file if you're okay with spending a minute or two over when you have to sync it.