![]() |
ARX
1.0
The next-generation open source augmented reality toolkit.
|
#include <ARX/AR/ar.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <ARX/AR/icp.h>
#include <ARX/AR2/tracking.h>
#include <ARX/AR2/util.h>
Functions | |
AR2HandleT * | ar2CreateHandle (ARParamLT *cparamLT, AR_PIXEL_FORMAT pixFormat, int threadNum) |
AR2HandleT * | ar2CreateHandleHomography (int xsize, int ysize, AR_PIXEL_FORMAT pixFormat, int threadNum) |
int | ar2DeleteHandle (AR2HandleT **ar2Handle) |
int | ar2SetTrackingMode (AR2HandleT *ar2Handle, int trackingMode) |
int | ar2GetTrackingMode (AR2HandleT *ar2Handle, int *trackingMode) |
int | ar2SetSimThresh (AR2HandleT *ar2Handle, float simThresh) |
int | ar2GetSimThresh (AR2HandleT *ar2Handle, float *simThresh) |
int | ar2SetTrackingThresh (AR2HandleT *ar2Handle, float trackingThresh) |
int | ar2GetTrackingThresh (AR2HandleT *ar2Handle, float *trackingThresh) |
int | ar2SetSearchSize (AR2HandleT *ar2Handle, int searchSize) |
int | ar2GetSearchSize (AR2HandleT *ar2Handle, int *searchSize) |
int | ar2SetSearchFeatureNum (AR2HandleT *ar2Handle, int searchFeatureNum) |
int | ar2GetSearchFeatureNum (AR2HandleT *ar2Handle, int *searchFeatureNum) |
int | ar2SetTemplateSize1 (AR2HandleT *ar2Handle, int templateSize1) |
int | ar2GetTemplateSize1 (AR2HandleT *ar2Handle, int *templateSize1) |
int | ar2SetTemplateSize2 (AR2HandleT *ar2Handle, int templateSize2) |
int | ar2GetTemplateSize2 (AR2HandleT *ar2Handle, int *templateSize2) |
AR2HandleT * ar2CreateHandle | ( | ARParamLT * | cparamLT, |
AR_PIXEL_FORMAT | pixFormat, | ||
int | threadNum | ||
) |
Allocate and initialise essential structures for NFT texture tracking, using full six degree-of-freedom tracking. Full 6 degree-of-freedom tracking requires a calibrated camera lens model, and provides measurement of surface position in all axes, as well as orientation.
cparamLT | Pointer to an ARParamLT structure holding camera parameters in lookup-table form. The pointer only is copied, and the ARParamLT structure itself is NOT copied, and must remain valid for the lifetime of the AR2HandleT. This structure also specifies the size of video frames which will be later supplied to the ar2Tracking() function as cparamLT->param.xsize and cparamLT->param.ysize. |
pixFormat | Pixel format of video frames which will be later supplied to the ar2Tracking() function. |
threadNum | Number of threads to spawn for the NFT texture tracking task. Use AR2_TRACKING_DEFAULT_THREAD_NUM to have artoolkitX calculate a sensible default. |
AR2HandleT * ar2CreateHandleHomography | ( | int | xsize, |
int | ysize, | ||
AR_PIXEL_FORMAT | pixFormat, | ||
int | threadNum | ||
) |
Allocate and initialise essential structures for NFT texture tracking, using homography-only tracking. Homography tracking assumes that the camera has zero lens-distortion, and this does not depend on camera parameters. It is therefore unable to provide correctly calibrated position measurements, but the resulting pose is suitable for visual overlay purposes.
xsize | Width of video frames which will be later supplied to the ar2Tracking() function. |
ysize | Height of video frames which will be later supplied to the ar2Tracking() function. |
pixFormat | Pixel format of video frames which will be later supplied to the ar2Tracking() function. |
threadNum | Number of threads to spawn for the NFT texture tracking task. Use AR2_TRACKING_DEFAULT_THREAD_NUM to have artoolkitX calculate a sensible default. |
int ar2DeleteHandle | ( | AR2HandleT ** | ar2Handle | ) |
Finalise and dispose of structures for NFT texture tracking. Once texture tracking processing has completed, this routine should be called to dispose of memory allocated.
ar2Handle | Pointer to a location which holds a pointer to a AR2HandleT structure. On return, the location pointed to will be set to NULL. |
int ar2GetSearchFeatureNum | ( | AR2HandleT * | ar2Handle, |
int * | searchTemplateMax | ||
) |
ar2Handle | Tracking settings structure, as returned via ar2CreateHandle. |
searchTemplateMax |
int ar2GetSearchSize | ( | AR2HandleT * | ar2Handle, |
int * | searchSize | ||
) |
Get feature point search window size. See the discussion under ar2SetSearchSize.
Default value is AR2_DEFAULT_SEARCH_SIZE, as defined in <AR2/config.h>
ar2Handle | Tracking settings structure, as returned via ar2CreateHandle. |
searchSize | Pointer to an int, which on return will be filled with the current search size in use. |
int ar2GetSimThresh | ( | AR2HandleT * | ar2Handle, |
float * | simThresh | ||
) |
ar2Handle | Tracking settings structure, as returned via ar2CreateHandle. |
simThresh |
int ar2GetTemplateSize1 | ( | AR2HandleT * | ar2Handle, |
int * | templateSize1 | ||
) |
ar2Handle | Tracking settings structure, as returned via ar2CreateHandle. |
templateSize1 |
int ar2GetTemplateSize2 | ( | AR2HandleT * | ar2Handle, |
int * | templateSize2 | ||
) |
ar2Handle | Tracking settings structure, as returned via ar2CreateHandle. |
templateSize2 |
int ar2GetTrackingMode | ( | AR2HandleT * | ar2Handle, |
int * | trackingMode | ||
) |
Report whether an AR2HandleT is providing full 6 degree-of-freedom tracking or homography extraction only.
ar2Handle | Tracking settings structure, as returned via ar2CreateHandle. |
trackingMode |
int ar2GetTrackingThresh | ( | AR2HandleT * | ar2Handle, |
float * | trackingThresh | ||
) |
Get threshold value for acceptable pose estimate error. See the discussion under ar2SetTrackingThresh.
Default value is AR2_DEFAULT_TRACKING_THRESH, as defined in <AR2/config.h>
ar2Handle | Tracking settings structure, as returned via ar2CreateHandle. |
trackingThresh | Pointer to a float, which on return will be filled with the threshold value. |
int ar2SetSearchFeatureNum | ( | AR2HandleT * | ar2Handle, |
int | searchTemplateMax | ||
) |
ar2Handle | Tracking settings structure, as returned via ar2CreateHandle. |
searchTemplateMax |
int ar2SetSearchSize | ( | AR2HandleT * | ar2Handle, |
int | searchSize | ||
) |
Set feature point search window size. Sets the size of the window around a feature location from previous frame in which the feature will be searched for in the next frame. Value is radius of the search window, in pixels. I.e. searchSize pixels either size of the current feature position will be searched for the new location of the feature.
A larger search window allows for greater movement of a feature between frames (e.g. faster optical motion, or same degree of optical motion but at a higher frame resolution), at the cost of greater search effort. Search effort increases with the square of the search radius.
Default value is AR2_DEFAULT_SEARCH_SIZE, as defined in <AR2/config.h>
ar2Handle | Tracking settings structure, as returned via ar2CreateHandle. |
searchSize | The new search size to use. |
int ar2SetSimThresh | ( | AR2HandleT * | ar2Handle, |
float | simThresh | ||
) |
ar2Handle | Tracking settings structure, as returned via ar2CreateHandle. |
simThresh |
int ar2SetTemplateSize1 | ( | AR2HandleT * | ar2Handle, |
int | templateSize1 | ||
) |
ar2Handle | Tracking settings structure, as returned via ar2CreateHandle. |
templateSize1 |
int ar2SetTemplateSize2 | ( | AR2HandleT * | ar2Handle, |
int | templateSize2 | ||
) |
ar2Handle | Tracking settings structure, as returned via ar2CreateHandle. |
templateSize2 |
int ar2SetTrackingMode | ( | AR2HandleT * | ar2Handle, |
int | trackingMode | ||
) |
Choose whether full 6 degree-of-freedom tracking is performed, or homography extraction only. Note that while it is possible to switch an AR2HandleT created in 6DOF mode (via ar2CreateHandle) to HOMOGRAPHY mode and back to 6DOF ,an AR2HandleT created in HOMOGRAPHY mode (via ar2CreateHandleHomography) cannot be switched to 6DOF mode.
ar2Handle | Tracking settings structure, as returned via ar2CreateHandle. |
trackingMode | Either AR2_TRACKING_6DOF or AR2_TRACKING_HOMOGRAPHY. |
int ar2SetTrackingThresh | ( | AR2HandleT * | ar2Handle, |
float | trackingThresh | ||
) |
Set threshold value for acceptable pose estimate error. During the final phase of a single tracking pass, the pose estimate is calculated, along with an estimate of the error in this value (an uncertainty). A higher value indicates less goodness-of-fit of the pose estimate to the data. If only high-quality pose estimates are desired, this function can be used to lower the acceptable maximum error value.
The actual error value itself is reported in parameter 'err' of function ar2Tracking.
Default value is AR2_DEFAULT_TRACKING_THRESH, as defined in <AR2/config.h>
ar2Handle | Tracking settings structure, as returned via ar2CreateHandle. |
trackingThresh | floating point value to use as the new tracking threshold. |