ARX  1.0
The next-generation open source augmented reality toolkit.
Loading...
Searching...
No Matches
Functions
handle.c File Reference
#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>
Include dependency graph for handle.c:

Functions

AR2HandleTar2CreateHandle (ARParamLT *cparamLT, AR_PIXEL_FORMAT pixFormat, int threadNum)
 
AR2HandleTar2CreateHandleHomography (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)
 

Function Documentation

◆ ar2CreateHandle()

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.

Parameters
cparamLTPointer 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.
pixFormatPixel format of video frames which will be later supplied to the ar2Tracking() function.
threadNumNumber of threads to spawn for the NFT texture tracking task. Use AR2_TRACKING_DEFAULT_THREAD_NUM to have artoolkitX calculate a sensible default.
Returns
Pointer to a newly allocated AR2HandleT structure, which holds the current state of the NFT texture tracker, or NULL if an error occurred. This structure must be deallocated via a call to ar2DeleteHandle() when no longer needed.
See also
ar2CreateHandleHomography ar2CreateHandleHomography
ar2DeleteHandle ar2DeleteHandle
Here is the call graph for this function:

◆ ar2CreateHandleHomography()

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.

Parameters
xsizeWidth of video frames which will be later supplied to the ar2Tracking() function.
ysizeHeight of video frames which will be later supplied to the ar2Tracking() function.
pixFormatPixel format of video frames which will be later supplied to the ar2Tracking() function.
threadNumNumber of threads to spawn for the NFT texture tracking task. Use AR2_TRACKING_DEFAULT_THREAD_NUM to have artoolkitX calculate a sensible default.
Returns
Pointer to a newly allocated AR2HandleT structure, which holds the current state of the NFT texture tracker, or NULL if an error occurred. This structure must be deallocated via a call to ar2DeleteHandle() when no longer needed.
See also
ar2CreateHandle ar2CreateHandle
ar2DeleteHandle ar2DeleteHandle

◆ ar2DeleteHandle()

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.

Parameters
ar2HandlePointer to a location which holds a pointer to a AR2HandleT structure. On return, the location pointed to will be set to NULL.
Returns
-1 in case of error, or 0 otherwise.
See also
ar2CreateHandle ar2CreateHandle
ar2CreateHandleHomography ar2CreateHandleHomography
Here is the call graph for this function:

◆ ar2GetSearchFeatureNum()

int ar2GetSearchFeatureNum ( AR2HandleT ar2Handle,
int *  searchTemplateMax 
)
Parameters
ar2HandleTracking settings structure, as returned via ar2CreateHandle.
searchTemplateMax
Returns
-1 in case of error, or 0 otherwise.

◆ ar2GetSearchSize()

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>

Parameters
ar2HandleTracking settings structure, as returned via ar2CreateHandle.
searchSizePointer to an int, which on return will be filled with the current search size in use.
Returns
-1 in case of error, or 0 otherwise.
See also
ar2SetSearchSize ar2SetSearchSize

◆ ar2GetSimThresh()

int ar2GetSimThresh ( AR2HandleT ar2Handle,
float *  simThresh 
)
Parameters
ar2HandleTracking settings structure, as returned via ar2CreateHandle.
simThresh
Returns
-1 in case of error, or 0 otherwise.

◆ ar2GetTemplateSize1()

int ar2GetTemplateSize1 ( AR2HandleT ar2Handle,
int *  templateSize1 
)
Parameters
ar2HandleTracking settings structure, as returned via ar2CreateHandle.
templateSize1
Returns
-1 in case of error, or 0 otherwise.

◆ ar2GetTemplateSize2()

int ar2GetTemplateSize2 ( AR2HandleT ar2Handle,
int *  templateSize2 
)
Parameters
ar2HandleTracking settings structure, as returned via ar2CreateHandle.
templateSize2
Returns
-1 in case of error, or 0 otherwise.

◆ ar2GetTrackingMode()

int ar2GetTrackingMode ( AR2HandleT ar2Handle,
int *  trackingMode 
)

Report whether an AR2HandleT is providing full 6 degree-of-freedom tracking or homography extraction only.

Parameters
ar2HandleTracking settings structure, as returned via ar2CreateHandle.
trackingMode
Returns
-1 in case of error, or 0 otherwise.
See also
ar2CreateHandle ar2CreateHandle
ar2CreateHandleHomography ar2CreateHandleHomography
ar2SetTrackingMode ar2SetTrackingMode

◆ ar2GetTrackingThresh()

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>

Parameters
ar2HandleTracking settings structure, as returned via ar2CreateHandle.
trackingThreshPointer to a float, which on return will be filled with the threshold value.
Returns
-1 in case of error, or 0 otherwise.
See also
ar2SetTrackingThresh ar2SetTrackingThresh

◆ ar2SetSearchFeatureNum()

int ar2SetSearchFeatureNum ( AR2HandleT ar2Handle,
int  searchTemplateMax 
)
Parameters
ar2HandleTracking settings structure, as returned via ar2CreateHandle.
searchTemplateMax
Returns
-1 in case of error, or 0 otherwise.

◆ ar2SetSearchSize()

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>

Parameters
ar2HandleTracking settings structure, as returned via ar2CreateHandle.
searchSizeThe new search size to use.
Returns
-1 in case of error, or 0 otherwise.
See also
ar2GetSearchSize ar2GetSearchSize

◆ ar2SetSimThresh()

int ar2SetSimThresh ( AR2HandleT ar2Handle,
float  simThresh 
)
Parameters
ar2HandleTracking settings structure, as returned via ar2CreateHandle.
simThresh
Returns
-1 in case of error, or 0 otherwise.

◆ ar2SetTemplateSize1()

int ar2SetTemplateSize1 ( AR2HandleT ar2Handle,
int  templateSize1 
)
Parameters
ar2HandleTracking settings structure, as returned via ar2CreateHandle.
templateSize1
Returns
-1 in case of error, or 0 otherwise.

◆ ar2SetTemplateSize2()

int ar2SetTemplateSize2 ( AR2HandleT ar2Handle,
int  templateSize2 
)
Parameters
ar2HandleTracking settings structure, as returned via ar2CreateHandle.
templateSize2
Returns
-1 in case of error, or 0 otherwise.

◆ ar2SetTrackingMode()

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.

Parameters
ar2HandleTracking settings structure, as returned via ar2CreateHandle.
trackingModeEither AR2_TRACKING_6DOF or AR2_TRACKING_HOMOGRAPHY.
Returns
-1 in case of error, or 0 otherwise.
See also
ar2CreateHandle ar2CreateHandle
ar2CreateHandleHomography ar2CreateHandleHomography
ar2GetTrackingMode ar2GetTrackingMode

◆ ar2SetTrackingThresh()

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>

Parameters
ar2HandleTracking settings structure, as returned via ar2CreateHandle.
trackingThreshfloating point value to use as the new tracking threshold.
Returns
-1 in case of error, or 0 otherwise.
See also
ar2GetTrackingThresh ar2GetTrackingThresh
ar2Tracking ar2Tracking