tracking
IntroductionARToolKit NFT core routines. DiscussionThis header declares essential types and API for the NFT portion of the ARToolKit SDK. For compile-time per-machine and NFT configuration, see <AR2/config.h>. Functions
ar2CreateHandleAllocate and initialise essential structures for NFT texture tracking, using full six degree-of-freedom tracking. AR2HandleT *ar2CreateHandle ( ARParamLT *cparamLT, AR_PIXEL_FORMAT pixFormat, int threadNum ); Parameters
Return ValuePointer 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. DiscussionFull 6 degree-of-freedom tracking requires a calibrated camera lens model, and provides measurement of surface position in all axes, as well as orientation. See Also ar2CreateHandleHomographyAllocate and initialise essential structures for NFT texture tracking, using homography-only tracking. AR2HandleT *ar2CreateHandleHomography ( int xsize, int ysize, AR_PIXEL_FORMAT pixFormat, int threadNum ); Parameters
Return ValuePointer 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. DiscussionHomography 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. See Also ar2DeleteHandleFinalise and dispose of structures for NFT texture tracking. int ar2DeleteHandle ( AR2HandleT **ar2Handle ); ParametersReturn Value-1 in case of error, or 0 otherwise. DiscussionOnce texture tracking processing has completed, this routine should be called to dispose of memory allocated. See Also ar2FreeSurfaceSetFinalise and dispose of an NFT texture tracking surface set. int ar2FreeSurfaceSet ( AR2SurfaceSetT **surfaceSet ); ParametersReturn Value0 if successful, -1 otherwise. DiscussionOnce a surface set (read by ar2ReadSurfaceSet()) is no longer required, it should be disposed of by calling ar2FreeSurfaceSet(). See Also ar2GetSearchFeatureNumint ar2GetSearchFeatureNum ( AR2HandleT *ar2Handle, int *searchTemplateMax ); ParametersReturn Value-1 in case of error, or 0 otherwise. ar2GetSearchSizeGet feature point search window size. int ar2GetSearchSize ( AR2HandleT *ar2Handle, int *searchSize ); ParametersReturn Value-1 in case of error, or 0 otherwise. DiscussionSee the discussion under ar2SetSearchSize. Default value is AR2_DEFAULT_SEARCH_SIZE, as defined in <AR2/config.h> See Also ar2GetSimThreshint ar2GetSimThresh ( AR2HandleT *ar2Handle, float *simThresh ); ParametersReturn Value-1 in case of error, or 0 otherwise. ar2GetTemplateSize1int ar2GetTemplateSize1 ( AR2HandleT *ar2Handle, int *templateSize1 ); ParametersReturn Value-1 in case of error, or 0 otherwise. ar2GetTemplateSize2int ar2GetTemplateSize2 ( AR2HandleT *ar2Handle, int *templateSize2 ); ParametersReturn Value-1 in case of error, or 0 otherwise. ar2GetTrackingModeReport whether an AR2HandleT is providing full 6 degree-of-freedom tracking or homography extraction only. int ar2GetTrackingMode ( AR2HandleT *ar2Handle, int *trackingMode ); ParametersReturn Value-1 in case of error, or 0 otherwise. See Also ar2GetTrackingThreshGet threshold value for acceptable pose estimate error. int ar2GetTrackingThresh ( AR2HandleT *ar2Handle, float *trackingThresh ); ParametersReturn Value-1 in case of error, or 0 otherwise. DiscussionSee the discussion under ar2SetTrackingThresh. Default value is AR2_DEFAULT_TRACKING_THRESH, as defined in <AR2/config.h> See Also ar2ReadSurfaceSetRead an NFT texture tracking surface set from file. AR2SurfaceSetT *ar2ReadSurfaceSet ( const char *filename, const char *ext, ARPattHandle *pattHandle ); Parameters
Return ValueA pointer to the loaded AR2SurfaceSetT, or NULL in case of error. DiscussionAllocates, initialises and reads the contents of a surface set from storage. The surface set is usually generated by the genTexData utility, or equivalent. Once the surface set is no longer required, it should be disposed of by calling ar2FreeSurfaceSet(). See Also ar2SetInitTransSets initial transform for subsequent NFT texture tracking. int ar2SetInitTrans ( AR2SurfaceSetT *surfaceSet, float trans[3][4] ); ParametersReturn Value0 if successful, or -1 in case of error. DiscussionBefore the first call to ar2Tracking(), this function must be called to set the initial tracking transform. The initial transform may be obtained from NFT KPM tracking, or via a fiducial marker embedded in the NFT image. The initial transform must also be set after each loss of tracking (i.e. after each instance when ar2Tracking() does not return 0. See Also ar2SetSearchFeatureNumint ar2SetSearchFeatureNum ( AR2HandleT *ar2Handle, int searchTemplateMax ); ParametersReturn Value-1 in case of error, or 0 otherwise. ar2SetSearchSizeSet feature point search window size. int ar2SetSearchSize ( AR2HandleT *ar2Handle, int searchSize ); ParametersReturn Value-1 in case of error, or 0 otherwise. DiscussionSets 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> See Also ar2SetSimThreshint ar2SetSimThresh ( AR2HandleT *ar2Handle, float simThresh ); ParametersReturn Value-1 in case of error, or 0 otherwise. ar2SetTemplateSize1int ar2SetTemplateSize1 ( AR2HandleT *ar2Handle, int templateSize1 ); ParametersReturn Value-1 in case of error, or 0 otherwise. ar2SetTemplateSize2int ar2SetTemplateSize2 ( AR2HandleT *ar2Handle, int templateSize2 ); ParametersReturn Value-1 in case of error, or 0 otherwise. ar2SetTrackingModeChoose whether full 6 degree-of-freedom tracking is performed, or homography extraction only. int ar2SetTrackingMode ( AR2HandleT *ar2Handle, int trackingMode ); ParametersReturn Value-1 in case of error, or 0 otherwise. DiscussionNote 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. See Also ar2SetTrackingThreshSet threshold value for acceptable pose estimate error. int ar2SetTrackingThresh ( AR2HandleT *ar2Handle, float trackingThresh ); ParametersReturn Value-1 in case of error, or 0 otherwise. DiscussionDuring 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> See Also ar2TrackingPerform NFT texture tracking on an image frame. int ar2Tracking ( AR2HandleT *ar2Handle, AR2SurfaceSetT *surfaceSet, ARUint8 *dataPtr, float trans[3][4], float *err ); Parameters
Return Value0 in case of successful tracking, or < 0 in case of error.
Error codes: DiscussionBefore the first call to this function, ar2SetInitTrans() must be called to set the initial tracking transform. The initial transform may be obtained from NFT KPM tracking, or via a fiducial marker embedded in the NFT image. The initial transform must also be set after each loss of tracking (i.e. after each instance when this function does not return 0. See Also |