Running the simpleNFT2 example
From ARToolworks support library
Open a command-line window (Terminal on Mac OS X/Linux, cmd.exe on Windows). Navigate to your ARToolKitNFT/bin directory. The NFT data set to use must be specified as a command-line argument. As a sample, the "pinball" dataset (an image of a pinball play surface) is provided in ARToolKitNFT/bin/Data/pinball.kpm, and the contents of the directory ARToolKitNFT/bin/Data/pinball. This directory contains the required feature maps, sets, and the original image..
We will use the sample "pinball" to demonstrate the NFT tracking, via the sample code simpleNFT2.
1. Print out the jpeg file bin/Data/pinball/pinball.jpg on a colour printer.
The image is 1637 pixels wide and 2048 pixels high, with a resolution of 220 dots per inch (dpi). When printed at 1:1 scaling, its printed size should be 189.0 mm wide and 236.5 mm tall. This should fit comfortably onto a single sheet of A4 paper (210 mm x 297 mm) or US Letter paper (215.9 mm × 279.4 mm).
If instead you wish to print the image on smaller paper, the image will can either be cropped top and bottom, or scaled to fit. Cropping will maintain correct distance measurements in ARToolKit NFT, at the cost of perhaps losing some of the tracking points, whereas scaling will result in measurements returned by ARToolKit being scaled by the same amount.
The simpleNFT2 example expects its configuration file to be specified as a command-line argument. This means it needs to be either run from a command or terminal window, or from a shell which can pass command-line arguments.
2. On Windows, open a command-shell by typing “cmd” in the “Run” box found on the Windows start menu. On Mac OS X or Linux, open a Terminal window.
3. Change the working directory in your command shell to the ARToolKitNFT bin directory. On Windows and Mac OS X, you can type “cd” then leave a space, then drag the bin folder onto the command window; the full path to the bin folder should be entered automatically.
4. Type the command to launch simpleNFT2, providing the path to the config file.
For our example, the sample pinball dataset is provided in ARToolKitNFT/bin/Data/pinball.kpm, and the contents of the directory ARToolKitNFT/bin/Data/pinball/.
To use the sample, type
simpleNFT2.exe Data/pinballon Windows, or
./simpleNFT Data/pinballon Mac OS X or Linux. The program will add the required ".kpm" suffix to find the KPM data and will take the argument also as the name of the directory in which to find the file "config.dat" which points to the image set, feature sets and feature maps.
5. Once the application is running, point the camera at the image. The tracking should immediately pick up the image. Once the image is recognised, yellow squares will be drawn on top of the page. Then, if pre-trained features on the page are recognised by the NFT 1.0 tracker, the yellow squares will turn red.
A 297.0 mm x 210.0 mm green border will also be drawn around the outline of the page.
Changing settings while running simpleNFT2
The simpleNFT2 also allows parameters of the tracking to be changed, and some debug information to be displayed by pressing keys. The following keys are active:
|esc||Quit the application.|
|1||Toggle tracking mode between interlaced mode (FIELD_IMAGE, used for DV cameras) and non-interlaced mode (FRAME_IMAGE, used for normal cameras).|
|2||Toggle tracking mode between normal and fine NFT tracking.|
|3||Reduce similarity threshhold, i.e. be more permissive in matches between features in incoming video and surface.|
|4||Increase similarity threshhold, i.e. be more strict in matches between features in incoming video and surface.|
|b||Toggle between constant and adaptive blurring of tracked image.|
|7||Reduce blur level.|
|8||Increase blur level.|
|(space)||Toggle capture mode, in which video frames are recorded for later playback.|
|r||Toggle between realtime tracking and tracking from recorded frames.|
|9||If tracking from recorded frames, switch to an earlier recorded frame than the current frame.|
|0||If tracking from recorded frames, switch to a later recorded frame than the current frame.|
|d:||Turn on black-and-white debug mode.. you will see the binarised image as ARToolKit sees it. Recognised markers will be drawn with a red outline.|
|f||Turn on NFT debug mode. Information about the resolution of the tracked image in x and y dimensions of the page will be displayed to the console. Press again to see candidate features as they are extracted from the image.|
|[||Linux lib1394 video input only Decrease camera shutter speed.|
|]||Linux lib1394 video input only Increase camera shutter speed.|