public class ARToolKit
extends java.lang.Object
NativeInterface
class. Native calls
should be made only from within this class so that adequate error checking
and correct type conversion can take place.Modifier and Type | Method and Description |
---|---|
int |
addMarker(java.lang.String cfg)
Adds a new single marker to the set of currently active markers.
|
void |
cleanup()
Instructs the native code to free resources.
|
boolean |
convertAndDetect(byte[] frame)
Takes an incoming frame from the Android camera and passes it to native
code for conversion and marker detection.
|
Bitmap |
getDebugBitmap()
Returns the Bitmap containing the ARToolKit debug video image.
|
boolean |
getDebugMode()
Returns whether the ARToolKit debug video image is enabled.
|
static ARToolKit |
getInstance()
Implementation of the singleton pattern to provide a sole instance of the ARToolKit class.
|
float[] |
getProjectionMatrix()
Returns the projection matrix calculated from camera parameters.
|
int |
getThreshold()
Returns the threshold used to binarize the video image for marker
detection.
|
boolean |
initialiseAR(int videoWidth,
int videoHeight,
java.lang.String cameraParaPath,
int cameraIndex,
boolean cameraIsFrontFacing)
Initialises the ARToolKit using the specified video size.
|
boolean |
initialiseNative(java.lang.String resourcesDirectoryPath)
Initialises the native code library if it is available.
|
boolean |
isRunning()
Returns true when video and marker detection are running.
|
boolean |
nativeInitialised()
Returns whether the native library was found and successfully initialised.
|
float[] |
queryMarkerTransformation(int markerUID)
Returns the transformation matrix for the specifed marker.
|
boolean |
queryMarkerVisible(int markerUID)
Returns whether the marker with the specified ID is currently visible.
|
void |
setDebugMode(boolean debug)
Enables or disables the debug video image in ARToolKit.
|
void |
setThreshold(int threshold)
Sets the threshold used to binarize the video image for marker detection.
|
Bitmap |
updateDebugBitmap()
Gets an updated debug image buffer from the native library and uses it to
update the local color array.
|
public static ARToolKit getInstance()
public boolean initialiseNative(java.lang.String resourcesDirectoryPath)
resourcesDirectoryPath
- The full path (in the filesystem) to the directory to be used by the
native routines as the base for relative references.
e.g. Activity.getContext().getCacheDir().getAbsolutePath()
or Activity.getContext().getFilesDir().getAbsolutePath()public boolean nativeInitialised()
public boolean initialiseAR(int videoWidth, int videoHeight, java.lang.String cameraParaPath, int cameraIndex, boolean cameraIsFrontFacing)
videoWidth
- The width of the video image in pixels.videoHeight
- The height of the video image in pixels.cameraParaPath
- The full path (in the filesystem) to a camera parameter file,
or the path expressed relative to the resourcesDirectoryPath set in initialiseNative().public Bitmap updateDebugBitmap()
public Bitmap getDebugBitmap()
public void setDebugMode(boolean debug)
debug
- Whether or not to enable the debug video image.public boolean getDebugMode()
public void setThreshold(int threshold)
threshold
- The new threshold value in the range 0 to 255.public int getThreshold()
public float[] getProjectionMatrix()
public int addMarker(java.lang.String cfg)
patt
- The path to the pattern file to load.width
- The physical width of the marker being tracked, in millimeters.public boolean queryMarkerVisible(int markerUID)
markerUID
- The unique identifier (UID) of the marker to query.public float[] queryMarkerTransformation(int markerUID)
markerUID
- The unique identifier (UID) of the marker to query.public boolean isRunning()
public boolean convertAndDetect(byte[] frame)
frame
- New video frame to process.public void cleanup()