public class ARController
extends java.lang.Object
ARX_jni 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 |
addTrackable(java.lang.String cfg)
Adds a new single marker to the set of currently active markers.
|
float[] |
calculateReferenceMatrix(int idMarkerBase,
int idMarker2)
Calculates the reference matrix for the given markers.
|
boolean |
capture()
Checks for a new frame available from the camera and captures it if so.
|
float |
distance(int referenceMarker,
int markerId2)
Calculated the distance between two markers
|
boolean |
drawVideo(int videoSourceIndex)
Draw a video frame.
|
boolean |
drawVideoFinal(int videoSourceIndex)
Perform required cleanup after drawing of video frames.
|
boolean |
drawVideoInit(int videoSourceIndex)
Perform required initialisation for future drawing of video frames.
|
boolean |
drawVideoSettings(int videoSourceIndex,
int width,
int height,
boolean rotate90,
boolean flipH,
boolean flipV,
int hAlign,
int vAlign,
int scalingMode,
int[] viewport)
Set parameters of the rendering context for future drawing of video frames.
|
java.lang.String |
getARToolKitXVersion() |
float |
getBorderSize() |
boolean |
getDebugMode()
Returns whether the square tracker debug video image is enabled.
|
static ARController |
getInstance()
Implementation of the singleton pattern to provide a sole instance of the ARController class.
|
int |
getPatternCountMax() |
int |
getPatternSize() |
float[] |
getProjectionMatrix(float nearPlane,
float farPlane)
Returns the projection matrix calculated from camera parameters.
|
int |
getThreshold()
Returns the threshold used to binarize the video image for square marker detection.
|
boolean |
initialiseNative(java.lang.String resourcesDirectoryPath)
Initialises the native code library if it is available.
|
boolean |
isInited()
Queries whether artoolkitX is initialized.
|
boolean |
isRunning()
Returns true when video and tracking are running.
|
boolean |
queryTrackableVisibilityAndTransformation(int trackableUID,
float[] matrix)
Returns whether the marker with the specified ID is currently visible, and if visible the trackable transformation.
|
float[] |
retrievePosition(int referenceMarkerId,
int markerIdToGetThePositionFor)
Calculates the position depending on the referenceMarker
|
void |
setBorderSize(float size) |
void |
setDebugMode(boolean debug)
Enables or disables the debug video image in the square tracker.
|
void |
setPatternCountMax(int count) |
void |
setPatternSize(int size) |
void |
setThreshold(int threshold)
Sets the threshold used to binarize the video image for square marker detection.
|
boolean |
start(int videoWidth,
int videoHeight,
java.lang.String pixelFormat,
java.lang.String cameraParaPath,
int cameraIndex,
boolean cameraIsFrontFacing)
Initialises the ARController.
|
void |
stopAndFinal()
Stop and final.
|
boolean |
update()
Takes an incoming frame from the Android camera and passes it to native
code for conversion and tracking.
|
public static ARController 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 java.lang.String getARToolKitXVersion()
public boolean start(int videoWidth,
int videoHeight,
java.lang.String pixelFormat,
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.pixelFormat - string with format in which buffers will be pushed. Supported values include "NV21", "NV12", "YUV_420_888", "RGBA", "RGB_565", and "MONO".cameraParaPath - Either: null to search for camera parameters specific to the device,
or a path (in the filesystem) to a camera parameter file. The path may be an
absolute path, or relative to the resourcesDirectoryPath set in initialiseNative().cameraIsFrontFacing - false to search for a rear-facing camera, or true to search for a camera facing toward the user.cameraIndex - Zero-based index of the camera in use, i.e. if 0, the first camera facing in the requested direction will be used, if 1 then the second etc.public boolean getDebugMode()
public void setDebugMode(boolean debug)
debug - Whether or not to enable the square tracker debug video image.public int getThreshold()
public void setThreshold(int threshold)
threshold - The new threshold value in the range 0 to 255.public float getBorderSize()
public void setBorderSize(float size)
public int getPatternSize()
public void setPatternSize(int size)
public int getPatternCountMax()
public void setPatternCountMax(int count)
public float[] getProjectionMatrix(float nearPlane,
float farPlane)
nearPlane - The value to use for the near OpenGL clipping plane.farPlane - The value to use for the far OpenGL clipping plane.public int addTrackable(java.lang.String cfg)
cfg - The settings string for the used marker. Possible configurations look like this:
`single;data/hiro.patt;80`
`single_buffer;80;buffer=234 221 237...`
`single_barcode;0;80`
`multi;data/multi/marker.dat`
`nft;data/nft/pinball`public boolean queryTrackableVisibilityAndTransformation(int trackableUID,
float[] matrix)
trackableUID - The unique identifier (UID) of the trackable to query.public boolean isInited()
initialiseNative(String). At
this point arwStartRunning can be called.public boolean isRunning()
public boolean capture()
public boolean update()
public void stopAndFinal()
public float[] calculateReferenceMatrix(int idMarkerBase,
int idMarker2)
idMarkerBase - Reference baseidMarker2 - Marker that will be depending on that basepublic float distance(int referenceMarker,
int markerId2)
referenceMarker - Reference base. Marker from which the distance is calculatedmarkerId2 - Marker to which the distance is calculatedpublic float[] retrievePosition(int referenceMarkerId,
int markerIdToGetThePositionFor)
referenceMarkerId - Reference marker idmarkerIdToGetThePositionFor - Id of the marker for which the position is calculatedpublic boolean drawVideoInit(int videoSourceIndex)
videoSourceIndex - 0, or a video source with multiple inputs, the 0-based index of the active video source.public boolean drawVideoSettings(int videoSourceIndex,
int width,
int height,
boolean rotate90,
boolean flipH,
boolean flipV,
int hAlign,
int vAlign,
int scalingMode,
int[] viewport)
videoSourceIndex - 0, or a video source with multiple inputs, the 0-based index of the active video source.public boolean drawVideo(int videoSourceIndex)
videoSourceIndex - 0, or a video source with multiple inputs, the 0-based index of the active video source.public boolean drawVideoFinal(int videoSourceIndex)
videoSourceIndex - 0, or a video source with multiple inputs, the 0-based index of the active video source.