ar
IntroductionARToolKit core routines. DiscussionThis header declares essential types and API for the entire ARToolKit SDK. For compile-time per-machine configuration, see <AR/config.h>. Groups"Utility".Group members:
"Square detection".Group members:
"3D calculation by Stereo".
"Pattern identification".Group members:
"3D calculation".Group members:
Functions
ar3DChangeCpara(description) int ar3DChangeCpara( AR3DHandle *handle, ARdouble cpara[3][4] ); ParametersReturn Value(description) Discussion(description) ar3DChangeLoopBreakThresh(description) int ar3DChangeLoopBreakThresh( AR3DHandle *handle, ARdouble loopBreakThresh ); ParametersReturn Value(description) Discussion(description) ar3DChangeLoopBreakThreshRatio(description) int ar3DChangeLoopBreakThreshRatio( AR3DHandle *handle, ARdouble loopBreakThreshRatio ); ParametersReturn Value(description) Discussion(description) ar3DChangeMaxLoopCount(description) int ar3DChangeMaxLoopCount( AR3DHandle *handle, int maxLoopCount ); ParametersReturn Value(description) Discussion(description) ar3DCreateHandleCreate handle used for 3D calculation from calibrated camera parameters. AR3DHandle *ar3DCreateHandle( ARParam *arParam); ParametersReturn ValueThe handle. When no more ar3D*() functions need be called, the handle should be deleted by calling ar3DDeleteHandle(). DiscussionAn AR3DHandle holds data structures used in calculating the 3D pose of a marker from the 2D location of its corners (i.e. pose estimation). See Also ar3DCreateHandle2Create handle used for 3D calculation from an intrinsic parameters matrix. AR3DHandle *ar3DCreateHandle2( ARdouble cpara[3][4]); ParametersReturn ValueThe handle. When no more ar3D*() functions need be called, the handle should be deleted by calling ar3DDeleteHandle(). DiscussionAn AR3DHandle holds data structures used in calculating the 3D pose of a marker from the 2D location of its corners (i.e. pose estimation). See Also ar3DDeleteHandleDelete handle used for 3D calculation. int ar3DDeleteHandle( AR3DHandle **handle ); ParametersReturn Value0 if the handle was successfully deleted, -1 otherwise. DiscussionWhen no more ar3D*() functions need be called, the handle should be deleted by calling ar3DDeleteHandle(). See Also arCreateHandleCreate a handle to hold settings for an ARToolKit tracker instance. ARHandle *arCreateHandle( ARParamLT *paramLT ); Parameters
Return ValueAn ARHandle which should be passed to other functions which deal with the operations of the ARToolKit tracker. DiscussionARHandle is the primary structure holding the settings for a single ARToolKit square marker tracking instance. Settings include expected video stream image size and pixel format, tracking modes, loaded markers and more. Expected video stream image size is taken directly from the supplied ARParamLT structure's xsize and ysize fields. Video stream image pixel format defaults to AR_DEFAULT_PIXEL_FORMAT, which is platform and video-module dependent. Usually a call to arSetPixelFormat() is advisable to set the correct format. After creation of the ARHandle, tracking settings should be set via appropriate calls to other arSet*() functions. The ARHandle should be disposed of via a call to arDeleteHandle when tracking with this instance is complete. See Also arDeleteHandleDelete a handle which holds settings for an ARToolKit tracker instance. int arDeleteHandle( ARHandle *handle ); ParametersReturn Value0 if no error occured. DiscussionThe calibrated camera parameters pointed to by the handle are NOT deleted by this operation. See Also arDetectMarkerDetect markers in a video frame. int arDetectMarker( ARHandle *arHandle, ARUint8 *dataPtr ); Parameters
Return Value0 if the function proceeded without error, or a value less than 0 in case of error. A result of 0 does not however, imply any markers were detected. DiscussionThis is the core ARToolKit marker detection function. It calls through to a set of internal functions to perform the key marker detection steps of binarization and labelling, contour extraction, and template matching and/or matrix code extraction. Typically, the resulting set of detected markers is retrieved by calling arGetMarkerNum to get the number of markers detected and arGetMarker to get an array of ARMarkerInfo structures with information on each detected marker, followed by a step in which detected markers are possibly examined for some measure of goodness of match (e.g. by examining the match confidence value) and pose extraction. See Also arGetBorderSizeGet the border size. int arGetBorderSize( ARHandle *handle, ARdouble *borderSize ); ParametersReturn Value0 if no error occured. DiscussionN.B. Deprecated in favour of arGetPattRatio(), but retained for backwards compatibility. arGetDebugModeFind out whether ARToolKit's debug mode is enabled. int arGetDebugMode( ARHandle *handle, int *mode ); ParametersReturn Value0 if no error occured. DiscussionSee arSetDebugMode() for more info. arGetImageProcModeGet the image processing mode. int arGetImageProcMode( ARHandle *handle, int *mode ); ParametersReturn Value0 if no error occured. DiscussionSee arSetImageProcMode() for a complete description. arGetLabelingModeEnquire whether detection is looking for black markers or white markers. int arGetLabelingMode( ARHandle *handle, int *mode ); ParametersReturn Value0 if no error occured. DiscussionSee discussion for arSetLabelingMode. arGetLabelingThreshGet the current labeling threshold. int arGetLabelingThresh( ARHandle *handle, int *thresh ); ParametersReturn Value0 if no error occured. DiscussionThis function queries the current labeling threshold. For, AR_LABELING_THRESH_MODE_AUTO_MEDIAN and AR_LABELING_THRESH_MODE_AUTO_OTSU, the threshold value is only valid until the next auto-update. The current threshold mode is not affected by this call. The threshold value is not relevant if threshold mode is AR_LABELING_THRESH_MODE_AUTO_ADAPTIVE. See Also arGetLabelingThreshModeGet the labeling threshold mode (auto/manual). int arGetLabelingThreshMode( const ARHandle *handle, AR_LABELING_THRESH_MODE *mode_p); Parameters
Return Value0 if no error occured. See Also arGetLabelingThreshModeAutoIntervalGet the number of frames between auto-threshold calculations. int arGetLabelingThreshModeAutoInterval( const ARHandle *handle, int *interval_p); ParametersReturn Value0 if no error occured. DiscussionThis is the number of frames BETWEEN calculations, meaning that the calculation occurs every (interval + 1) frames. See Also arGetMarkerGet information on the markers detected in a video frame. ARMarkerInfo *arGetMarker( ARHandle *arHandle ); ParametersReturn ValueAn array (of length arGetMarkerNum(arHandle)) of ARMarkerInfo structs. A better name for this function would be arGetDetectedMarkerInfo, but the current name lives on for historical reasons. See Also arGetMarkerExtractionModeGet the marker extraction mode int arGetMarkerExtractionMode( ARHandle *handle, int *mode ); ParametersReturn Value0 if no error occured. Discussion(description) arGetMarkerInfoExamine a set of detected squares for match with known markers. int arGetMarkerInfo( ARUint8 *image, int xsize, int ysize, int pixelFormat, ARMarkerInfo2 *markerInfo2, int marker2_num, ARPattHandle *pattHandle, int imageProcMode, int pattDetectMode, ARParamLTf *arParamLTf, ARdouble pattRatio, ARMarkerInfo *markerInfo, int *marker_num, const AR_MATRIX_CODE_TYPE matrixCodeType ); Parameters
Return Value0 in case of no error, or -1 otherwise. DiscussionPerforms the intermediate marker-detection stage of taking detected squares in a processed image, and matching the interior of these squares against known marker templates, or extracting matrix codes from the interior of the square. See Also arGetMarkerNumGet the number of markers detected in a video frame. int arGetMarkerNum( ARHandle *arHandle ); ParametersReturn ValueThe number of detected markers in the most recent image passed to arDetectMarker. Note that this is actually a count, not an index. A better name for this function would be arGetDetectedMarkerCount, but the current name lives on for historical reasons. See Also arGetMatrixCodeTypeGet the size and ECC algorithm being used for matrix code (2D barcode) marker detection. int arGetMatrixCodeType( ARHandle *handle, AR_MATRIX_CODE_TYPE *type_p); ParametersReturn Value0 if no error occured. DiscussionSee the description for arSetMatrixCodeType(). See Also arGetPatternDetectionModeGet the pattern detection mode int arGetPatternDetectionMode( ARHandle *handle, int *mode ); ParametersReturn Value0 if no error occured. DiscussionSee arSetPatternDetectionMode() for a complete description. arGetPattRatioGet the width/height of the marker pattern space, as a proportion of marker width/height. int arGetPattRatio( ARHandle *handle, ARdouble *pattRatio ); Parameters
Return Value0 if no error occured. DiscussionN.B. Supercedes arGetBorderSize(). arGetPixelFormatGet the expected pixel format for video frames being passed to arDetectMarker int arGetPixelFormat( ARHandle *handle, AR_PIXEL_FORMAT *pixFormat ); ParametersReturn Value0 if no error occured. DiscussionSee discussion for arSetPixelFormat(). See Also arGetTransMat(description) ARdouble arGetTransMat( AR3DHandle *handle, ARdouble initConv[3][4], ARdouble pos2d[][2], ARdouble pos3d[][3], int num, ARdouble conv[3][4] ); ParametersReturn Value(description) Discussion(description) arGetTransMatRobust(description) ARdouble arGetTransMatRobust( AR3DHandle *handle, ARdouble initConv[3][4], ARdouble pos2d[][2], ARdouble pos3d[][3], int num, ARdouble conv[3][4] ); ParametersReturn Value(description) Discussion(description) arGetTransMatSquare(description) ARdouble arGetTransMatSquare( AR3DHandle *handle, ARMarkerInfo *marker_info, ARdouble width, ARdouble conv[3][4] ); ParametersReturn Value(description) Discussion(description) arGetTransMatSquareCont(description) ARdouble arGetTransMatSquareCont( AR3DHandle *handle, ARMarkerInfo *marker_info, ARdouble initConv[3][4], ARdouble width, ARdouble conv[3][4] ); ParametersReturn Value(description) Discussion(description) arGetVersionGet the ARToolKit version information in numberic and string format. ARUint32 arGetVersion( char **versionStringRef); Parameters
Return ValueReturns the full version number of the ARToolKit in binary coded decimal (BCD) format. BCD format allows simple tests of version number in the caller e.g. if ((arGetVersion(NULL) >> 16) > 0x0272) printf("This release is later than 2.72\n"); The major version number is encoded in the most-significant byte (bits 31-24), the minor version number in the second-most-significant byte (bits 23-16), the tiny version number in the third-most-significant byte (bits 15-8), and the build version number in the least-significant byte (bits 7-0). DiscussionAs of version 2.72, ARToolKit now allows querying of the version number of the toolkit available at runtime. It is highly recommended that any calling program that depends on features in a certain ARToolKit version, check at runtime that it is linked to a version of ARToolKit that can supply those features. It is NOT sufficient to check the ARToolKit SDK header versions, since with ARToolKit implemented in dynamically-loaded libraries, there is no guarantee that the version of ARToolKit installed on the machine at run-time will be as recent as the version of the ARToolKit SDK which the host program was compiled against. The version information is reported in binary-coded decimal format, and optionally in an ASCII string. A increase in the major version number indicates the removal of functionality previously provided in the API. An increase in the minor version number indicates that new functionality has been added. A change in the tiny version number indicates changes (e.g. bug fixes) which do not affect the API. See the comments in the config.h header for more discussion of the definition of major, minor, tiny and build version numbers. arPattActivateActivate a previously deactivated pattern. int arPattActivate( ARPattHandle *pattHandle, int patno ); ParametersReturn Value0 on success, or -1 if the pattern was already activated or no pattern was loaded. DiscussionWhen a pattern is activated, is becomes available for recognition in a scene. This is the default state for a loaded pattern. See Also arPattAttachAssociate a set of patterns with an ARHandle. int arPattAttach( ARHandle *arHandle, ARPattHandle *pattHandle); ParametersReturn ValueReturns 0 in the case of success, or -1 if the specified ARHandle already has an ARPattHandle attached, or if arHandle is NULL. DiscussionAssociating a set of patterns with an ARHandle makes the patterns the set which will be searched when marker identification is performed on an image associated with the same ARHandle. See Also arPattCreateHandleAllocate a pattern handle. ARPattHandle *arPattCreateHandle( void); Return ValueThe created pattern handle, or NULL in case of error. DiscussionAllocates an empty pattern handle, into which patterns can be loaded by calling arPattLoad(). When the pattern handle is no longer needed, it should be freed by calling arPattDeleteHandle(). Note that a pattern handle is NOT required when using only matrix- code (2D barcode) markers. See Also arPattDeactivateDeactivate a previously activated pattern. int arPattDeactivate( ARPattHandle *pattHandle, int patno); ParametersReturn Value0 on success, or -1 if the pattern was already deactivated or no pattern was loaded. DiscussionWhen a pattern is activated, is becomes unavailable for recognition in a scene. Deactivating unused patterns can speed up recognition time and accuracy when there are multiple patterns in a scene, and it is also useful for controlling interactivity in a scene. See Also arPattDeleteHandleFree all loaded patterns and pattern handle. int arPattDeleteHandle( ARPattHandle *pattHandle); ParametersReturn Value0 on success, or -1 if trying to free a NULL handle. DiscussionFrees a pattern handle, freeing (unloading) any patterns loaded into the handle in the process. arPattDetachReset an ARHandle to no pattern association. int arPattDetach( ARHandle *arHandle); ParametersReturn ValueReturns 0 in the case of success, or -1 if the specified ARHandle has no ARPattHandle attached, or if arHandle is NULL. DiscussionSee arPattAttach() for more information. See Also arPattFreeFrees (unloads) a pattern file from memory. int arPattFree( ARPattHandle *pattHandle, int patno ); ParametersReturn Value0 if the pattern was successfully unloaded, or -1 if there was no pattern loaded. DiscussionUnloads a pattern from a pattern handle, freeing that slot for another pattern to be loaded, if necessary. See Also arPattGetID2Match the interior of a detected square against known patterns. int arPattGetID2( ARPattHandle *pattHandle, int imageProcMode, int pattDetectMode, ARUint8 *image, int xsize, int ysize, AR_PIXEL_FORMAT pixelFormat, ARParamLTf *arParamLTf, ARdouble vertex[4][2], ARdouble pattRatio, int *codePatt, int *dirPatt, ARdouble *cfPatt, int *codeMatrix, int *dirMatrix, ARdouble *cfMatrix, const AR_MATRIX_CODE_TYPE matrixCodeType ); Parameters
Return Value0 if the function was able to correctly match, or -1 in case of error or no match. See Also arPattGetIDGlobalMatch the interior of a detected square against known patterns with variable border width. int arPattGetIDGlobal( ARPattHandle *pattHandle, int imageProcMode, int pattDetectMode, ARUint8 *image, int xsize, int ysize, AR_PIXEL_FORMAT pixelFormat, ARParamLTf *arParamLTf, ARdouble vertex[4][2], ARdouble pattRatio, int *codePatt, int *dirPatt, ARdouble *cfPatt, int *codeMatrix, int *dirMatrix, ARdouble *cfMatrix, const AR_MATRIX_CODE_TYPE matrixCodeType, int *errorCorrected, uint64_t *codeGlobalID_p ); Parameters
Return Value0 if the function was able to correctly match, or -1 in case of error or no match. See Also arPattGetImage2Extract the image (i.e. locate and unwarp) of the pattern-space portion of a detected square. int arPattGetImage2( int imageProcMode, int pattDetectMode, int patt_size, int sample_size, ARUint8 *image, int xsize, int ysize, AR_PIXEL_FORMAT pixelFormat, ARParamLTf *arParamLTf, ARdouble vertex[4][2], ARdouble pattRatio, ARUint8 *ext_patt ); Parameters
Return Value0 if the function was able to correctly get the image, or -1 in case of error or no match. See Also arPattGetImage3Extract the image (i.e. locate and unwarp) of an arbitrary portion of a detected square. int arPattGetImage3( ARHandle *arHandle, int markerNo, ARUint8 *image, ARPattRectInfo *rect, int xsize, int ysize, int overSampleScale, ARUint8 *outImage ); Parameters
Return Value0 if the function was able to correctly get the image, or -1 in case of error or no match. DiscussionUse this function to obtain an image of the marker pattern space for display to the user. See Also arPattLoadLoad a pattern file into a pattern handle. int arPattLoad( ARPattHandle *pattHandle, const char *filename ); Parameters
Return ValueReturns the index number of the loaded pattern, in the range [0, AR_PATT_NUM_MAX - 1], or -1 if the pattern could not be loaded because the maximum number of patterns (AR_PATT_NUM_MAX) has already been loaded already into this handle. DiscussionThis function loads a pattern template from a file on disk, and attaches it to the given ARPattHandle so making it available for future pattern-matching. Additional patterns can be loaded by calling again with the same ARPattHandle (however no more than AR_PATT_NUM_MAX patterns can be attached to a single ARPattHandle). Patterns are initially loaded in an active state. Note that matrix-code (2D barcode) markers do not have any associated pattern file and do not need to be loaded. See Also arPattSaveSave a pattern to a pattern file. int arPattSave( ARUint8 *image, int xsize, int ysize, int pixelFormat, ARParamLTf *paramLTf, int imageProcMode, ARMarkerInfo *marker_info, ARdouble pattRatio, int pattSize, const char *filename ); Parameters
Return Value(description) DiscussionThis function is used by the make_patt utility. See the sourcecode to mk_patt for usage. arSetBorderSizeSet the border size. int arSetBorderSize( ARHandle *handle, const ARdouble borderSize ); ParametersReturn Value0 if no error occured. DiscussionN.B. Deprecated in favour of arSetPattRatio(), but retained for backwards compatibility. arSetDebugModeEnable or disable ARToolKit's debug mode. int arSetDebugMode( ARHandle *handle, int mode ); ParametersReturn Value0 if no error occured. DiscussionIn debug mode, ARToolKit offers additional error reporting. Use this function to enable or disable debug mode at runtime. Additionally, in debug mode, ARToolKit creates a mono (8-bit grayscale) image of the thresholded video input, and makes this available through the field ARHandle->labelInfo.bwImage. arSetImageProcModeSet the image processing mode. int arSetImageProcMode( ARHandle *handle, int mode ); ParametersReturn Value0 if no error occured. DiscussionWhen ARthe image processing mode is AR_IMAGE_PROC_FRAME_IMAGE, ARToolKit processes all pixels in each incoming image to locate markers. When the mode is AR_IMAGE_PROC_FIELD_IMAGE, ARToolKit processes pixels in only every second pixel row and column. This is useful both for handling images from interlaced video sources (where alternate lines are assembled from alternate fields and thus have one field time-difference, resulting in a "comb" effect) such as Digital Video cameras. The effective reduction by 75% in the pixels processed also has utility in accelerating tracking by effectively reducing the image size to one quarter size, at the cost of pose accuraccy. arSetLabelingModeSelect between detection of black markers and white markers. int arSetLabelingMode( ARHandle *handle, int mode ); ParametersReturn Value0 if no error occured. DiscussionARToolKit's labelling algorithm can work with both black-bordered markers on a white background (AR_LABELING_BLACK_REGION) or white-bordered markers on a black background (AR_LABELING_WHITE_REGION). This function allows you to specify the type of markers to look for. Note that this does not affect the pattern-detection algorith which works on the interior of the marker. arSetLabelingThreshSet the labeling threshhold. int arSetLabelingThresh( ARHandle *handle, int thresh ); ParametersReturn Value0 if no error occured. DiscussionThis function forces the labeling threshold mode to AR_LABELING_THRESH_MODE_MANUAL and sets the threshold value. The default value is AR_DEFAULT_LABELING_THRESHm which is 100, unless edited in arConfig.h. Background: The labeling threshold is the value which the AR library uses to differentiate between black and white portions of an ARToolKit marker. Since the actual brightness, contrast, and gamma of incoming images can vary signficantly between different cameras and lighting conditions, this value typically needs to be adjusted dynamically to a suitable midpoint between the observed values for black and white portions of the markers in the image. arSetLabelingThreshModeSet the labeling threshold mode (auto/manual). int arSetLabelingThreshMode( ARHandle *handle, const AR_LABELING_THRESH_MODE mode); ParametersReturn Value0 if no error occured. See Also arSetLabelingThreshModeAutoIntervalSet the number of frames between auto-threshold calculations. int arSetLabelingThreshModeAutoInterval( ARHandle *handle, const int interval); Parameters
Return Value0 if no error occured. DiscussionThis is the number of frames BETWEEN calculations, meaning that the calculation occurs every (interval + 1) frames. See Also arSetMarkerExtractionModeSet the marker extraction mode int arSetMarkerExtractionMode( ARHandle *handle, int mode ); ParametersReturn Value0 if no error occured. Discussion(description) arSetMatrixCodeTypeSet the size and ECC algorithm to be used for matrix code (2D barcode) marker detection. int arSetMatrixCodeType( ARHandle *handle, const AR_MATRIX_CODE_TYPE type); Parameters
Return Value0 if no error occured. DiscussionWhen matrix-code (2D barcode) marker detection is enabled (see arSetPatternDetectionMode) then the size of the barcode pattern and the type of error checking and correction (ECC) with which the markers were produced can be set via this function. This setting is global to a given ARHandle; It is not possible to have two different matrix code types in use at once. See Also arSetPatternDetectionModeSet the pattern detection mode int arSetPatternDetectionMode( ARHandle *handle, int mode ); Parameters
Return Value0 if no error occured. DiscussionThe pattern detection determines the method by which ARToolKit matches detected squares in the video image to marker templates and/or IDs. ARToolKit v4.x can match against pictorial "template" markers, whose pattern files are created with the mk_patt utility, in either colour or mono, and additionally can match against 2D-barcode-type "matrix" markers, which have an embedded marker ID. Two different two-pass modes are also available, in which a matrix-detection pass is made first, followed by a template-matching pass. arSetPattRatioSet the width/height of the marker pattern space, as a proportion of marker width/height. int arSetPattRatio( ARHandle *handle, const ARdouble pattRatio ); Parameters
Return Value0 if no error occured. DiscussionN.B. Supercedes arSetBorderSize(). arSetPixelFormatSet the expected pixel format for video frames being passed to arDetectMarker int arSetPixelFormat( ARHandle *handle, AR_PIXEL_FORMAT pixFormat ); ParametersReturn Value0 if no error occured. DiscussionThis function should be used at least once after creation of an ARHandle, to set the pixel format with which images will be passed to arDetectMarker(). If not called, the default value AR_DEFAULT_PIXEL_FORMAT will be used. Note that AR_DEFAULT_PIXEL_FORMAT varies depending on platform and video module. If the pixel format of incoming video images changes, this value must also be changed. See Also arUtilChangeToResourcesDirectoryChange to the resources directory using the specified behavior. #ifdef ANDROID int arUtilChangeToResourcesDirectory( AR_UTIL_RESOURCES_DIRECTORY_BEHAVIOR behavior, const char *path, jobject instanceOfAndroidContext); #else int arUtilChangeToResourcesDirectory( AR_UTIL_RESOURCES_DIRECTORY_BEHAVIOR behavior, const char *path); #endif Parameters
Return Value-1 in the case of error, or 0 otherwise. DiscussionARToolKit uses relative paths to locate several types of resources, including camera parameter files, pattern files, multimarker files and others. This function provides the convenience of setting the current process working directory to the appropriate value for your application. On Android only, the function has an optional parameter 'instanceOfAndroidContext'. If behavior is AR_UTIL_RESOURCES_DIRECTORY_BEHAVIOR_USE_APP_CACHE_DIR, this parameter must be an instance of a class derived from android/content/Context. In all other cases, pass NULL for this parameter.
arUtilGetFileBasenameFromPathGet file base name from a path. char *arUtilGetFileBasenameFromPath( const char *path, const int convertToLowercase); ParametersReturn ValueA string with the basename portion of path. NB: The returned string must be freed by the caller. DiscussionGiven a full or partial pathname passed in string path, returns a string with the base name portion of path, i.e. the text between the rightmost path separator and the the rightmost '.' character, if any. If the filename contains no '.', returns the filename. arUtilGetFileExtensionFromPathGet file extension from a path. char *arUtilGetFileExtensionFromPath( const char *path, const int convertToLowercase); ParametersReturn ValueA string with the extension portion of path. NB: The returned string must be freed by the caller. DiscussionGiven a full or partial pathname passed in string path, returns a string with the extension portion of path, i.e. the text after the rightmost '.' character, if any. If the filename contains no '.', NULL is returned. arUtilGetFileURIGet a path as a file URI. char *arUtilGetFileURI( const char *path); ParametersReturn ValueA string with the the file URI for that path, or NULL in the case of error. NB: The returned string must be freed by the caller (by calling free() once its use is complete). DiscussionGiven a full or partial pathname passed in string path, returns a string with the file URI for that path. Partial pathnames are handled by concatening with the process's current working directory. arUtilGetPixelFormatNameGet a string holding a descriptive name for a given pixel format enumeration. const char *arUtilGetPixelFormatName( const AR_PIXEL_FORMAT arPixelFormat); ParametersReturn ValueA constant c-string holding a descriptive name for the pixel format. The string returned matches the constants used in the definition of the type AR_PIXEL_FORMAT, e.g. "AR_PIXEL_FORMAT_RGB". DiscussionOn occasions it can be useful to display to the user the format of the pixels which ARToolKit is processing. This funtion converts a pixel-format number into a human-readable string description. arUtilGetPixelSizeGet the size in bytes of a single pixel for a given pixel format. int arUtilGetPixelSize( const AR_PIXEL_FORMAT arPixelFormat ); ParametersReturn ValueNumber of bytes required to store 1 pixel of the given type. DiscussionDifferent pixel formats have different sizes in bytes, and therefore different storage requirements per row of pixels. Use this function to calculate the number of bytes required to store a single pixel of the given type. arUtilGetResourcesDirectoryPathGet the path to the resources directory using the specified behavior. #ifdef ANDROID char *arUtilGetResourcesDirectoryPath( AR_UTIL_RESOURCES_DIRECTORY_BEHAVIOR behavior, jobject instanceOfAndroidContext); #else char *arUtilGetResourcesDirectoryPath( AR_UTIL_RESOURCES_DIRECTORY_BEHAVIOR behavior); #endif ParametersReturn ValueNULL in the case of error, or the path otherwise. Must be free()d by the caller. DiscussionARToolKit uses relative paths to locate several types of resources, including camera parameter files, pattern files, multimarker files and others. This function provides the convenience of finding an appropriate value for your application. On Android only, the function has an optional parameter 'instanceOfAndroidContext'. If behavior is AR_UTIL_RESOURCES_DIRECTORY_BEHAVIOR_USE_APP_CACHE_DIR, this parameter must be an instance of a class derived from android/content/Context. In all other cases, pass NULL for this parameter. arUtilPrintMtx16Prints a 4x4 row-major matrix via ARLOG(...). void arUtilPrintMtx16( const ARdouble mtx16[16]); ParametersarUtilPrintTransMatPrints a transformation matrix via ARLOG(...). void arUtilPrintTransMat( const ARdouble trans[3][4]); ParametersarUtilSleepRelinquish CPU to the system for specified number of milliseconds. void arUtilSleep( int msec ); ParametersDiscussionThis function calls the native system-provided sleep routine to relinquish CPU control to the system for the specified time.
Typedefs
AR3DHandle(description) typedef struct { ICPHandleT *icpHandle; } AR3DHandle; FieldsDiscussion(description) AR3DStereoHandle(description) typedef struct { ICPStereoHandleT *icpStereoHandle; } AR3DStereoHandle; FieldsDiscussion(description) AR_MARKER_INFO_CUTOFF_PHASEResult codes returned by arDetectMarker to report state of individual detected trapezoidal regions. typedef enum { AR_MARKER_INFO_CUTOFF_PHASE_NONE, AR_MARKER_INFO_CUTOFF_PHASE_PATTERN_EXTRACTION, AR_MARKER_INFO_CUTOFF_PHASE_MATCH_GENERIC, AR_MARKER_INFO_CUTOFF_PHASE_MATCH_CONTRAST, AR_MARKER_INFO_CUTOFF_PHASE_MATCH_BARCODE_NOT_FOUND, AR_MARKER_INFO_CUTOFF_PHASE_MATCH_BARCODE_EDC_FAIL, AR_MARKER_INFO_CUTOFF_PHASE_MATCH_CONFIDENCE, AR_MARKER_INFO_CUTOFF_PHASE_POSE_ERROR, AR_MARKER_INFO_CUTOFF_PHASE_POSE_ERROR_MULTI, AR_MARKER_INFO_CUTOFF_PHASE_HEURISTIC_TROUBLESOME_MATRIX_CODES } AR_MARKER_INFO_CUTOFF_PHASE; Constants
DiscussionWhen detecting markers, all trapezoidal regions in the incoming image are considered for marker matching. Various heuristics are used to reject regions judged to be non-markers. The code will, as far as possible, report rejection by placing one of these constants into the ARMarkerInfo.cutoffPhase field of regions rejected during the arDetectMarker() call. Note that the ARMarkerInfo.id of such rejected regions will be -1. AR_UTIL_RESOURCES_DIRECTORY_BEHAVIOROptions for controlling the behavior of arUtilGetResourcesDirectoryPath and arUtilChangeToResourcesDirectory. typedef enum { AR_UTIL_RESOURCES_DIRECTORY_BEHAVIOR_BEST = 0, AR_UTIL_RESOURCES_DIRECTORY_BEHAVIOR_USE_CWD, AR_UTIL_RESOURCES_DIRECTORY_BEHAVIOR_USE_SUPPLIED_PATH, AR_UTIL_RESOURCES_DIRECTORY_BEHAVIOR_USE_EXECUTABLE_DIR, AR_UTIL_RESOURCES_DIRECTORY_BEHAVIOR_USE_BUNDLE_RESOURCES_DIR, AR_UTIL_RESOURCES_DIRECTORY_BEHAVIOR_USE_USER_ROOT, AR_UTIL_RESOURCES_DIRECTORY_BEHAVIOR_USE_APP_CACHE_DIR, AR_UTIL_RESOURCES_DIRECTORY_BEHAVIOR_USE_APP_DATA_DIR } AR_UTIL_RESOURCES_DIRECTORY_BEHAVIOR; Constants
See Also ARHandle(description) typedef struct { int arDebug; AR_PIXEL_FORMAT arPixelFormat; int arPixelSize; int arLabelingMode; int arLabelingThresh; int arImageProcMode; int arPatternDetectionMode; int arMarkerExtractionMode; ARParamLT *arParamLT; int xsize; int ysize; int marker_num; ARMarkerInfo markerInfo[AR_SQUARE_MAX]; int marker2_num; ARMarkerInfo2 markerInfo2[AR_SQUARE_MAX]; int history_num; ARTrackingHistory history[AR_SQUARE_MAX]; ARLabelInfo labelInfo; ARPattHandle *pattHandle; AR_LABELING_THRESH_MODE arLabelingThreshMode; int arLabelingThreshAutoInterval; int arLabelingThreshAutoIntervalTTL; ARImageProcInfo *arImageProcInfo; ARdouble pattRatio; AR_MATRIX_CODE_TYPE matrixCodeType; } ARHandle; Fields
Discussion(description) ARLabelInfo(description) typedef struct { AR_LABELING_LABEL_TYPE *labelImage; #if !AR_DISABLE_LABELING_DEBUG_MODE ARUint8 *bwImage; #endif int label_num; int area[AR_LABELING_WORK_SIZE]; int clip[AR_LABELING_WORK_SIZE][4]; ARdouble pos[AR_LABELING_WORK_SIZE][2]; int work[AR_LABELING_WORK_SIZE]; int work2[AR_LABELING_WORK_SIZE*7]; // area, pos[2], clip[4]. } ARLabelInfo; FieldsDiscussion(description) ARMarkerInfoDescribes a detected trapezoidal area (a candidate for a marker match). typedef struct { int area; int id; int idPatt; int idMatrix; int dir; int dirPatt; int dirMatrix; ARdouble cf; ARdouble cfPatt; ARdouble cfMatrix; ARdouble pos[2]; ARdouble line[4][3]; ARdouble vertex[4][2]; ARMarkerInfo2 *markerInfo2Ptr; AR_MARKER_INFO_CUTOFF_PHASE cutoffPhase; int errorCorrected; uint64_t globalID; } ARMarkerInfo; Fields
DiscussionAfter marker detection, a number of trapezoidal areas in the camera image will have been identified. An ARMarkerInfo struct is returned for each area so matched. Trapezoidal areas which have been matched with marker images (in pattern mode) or barcodes (in matrix mode) will have valid values assigned to the appropriate id field. ARMarkerInfo2(description) typedef struct { int area; ARdouble pos[2]; int coord_num; int x_coord[AR_CHAIN_MAX]; int y_coord[AR_CHAIN_MAX]; int vertex[5]; } ARMarkerInfo2; FieldsDiscussion(description) ARPattHandleA structure which holds descriptions of trained patterns for template matching. typedef struct { int patt_num; int patt_num_max; int *pattf; int **patt; ARdouble *pattpow; int **pattBW; ARdouble *pattpowBW; //ARdouble pattRatio; int pattSize; } ARPattHandle; Fields
DiscussionTemplate (picture)-based pattern matching requires details of the pattern to be supplied to the matching functions. This structure holds such details. It is generally setup by loading pattern files from disk. ARPattRectInfoDefines a pattern rectangle as a sub-portion of a marker image. typedef struct { float topLeftX; float topLeftY; float bottomRightX; float bottomRightY; } ARPattRectInfo; Fields
DiscussionA complete marker image has coordinates {0.0f, 0.0f, 1.0f, 1.0f}. A standard ARToolKit marker with a pattern ratio of 0.5 has coordinates {0.25f, 0.25f, 0.75f, 0.75f}. ARTrackingHistory(description) typedef struct { ARMarkerInfo marker; int count; } ARTrackingHistory; FieldsDiscussion(description) |