ARX  1.0
The next-generation open source augmented reality toolkit.
Loading...
Searching...
No Matches
Macros | Functions | Variables
arPattGetID.c File Reference
#include <ARX/AR/ar.h>
#include <stdio.h>
#include <math.h>
#include <stdint.h>
#include <stdbool.h>
Include dependency graph for arPattGetID.c:

Macros

#define MAX(x, y)   (x > y ? x : y)
 
#define MIN(x, y)   (x < y ? x : y)
 
#define CLAMP(x, r1, r2)   (MIN(MAX(x,r1),r2))
 
#define SQRT   sqrt
 
#define _100_0   100.0
 
#define _30_0   30.0
 
#define _10_0   10.0
 
#define _2_0   2.0
 
#define SQRT_3_0   1.7320508
 
#define _1_0   1.0
 
#define _0_5   0.5
 
#define _0_0   0.0
 
#define AR_GLOBAL_ID_OUTER_SIZE   14
 
#define AR_GLOBAL_ID_INNER_SIZE   3
 

Functions

int arPattGetID (ARPattHandle *pattHandle, int imageProcMode, int pattDetectMode, ARUint8 *image, int xsize, int ysize, AR_PIXEL_FORMAT pixelFormat, int *x_coord, int *y_coord, int *vertex, ARdouble pattRatio, int *code, int *dir, ARdouble *cf, const AR_MATRIX_CODE_TYPE matrixCodeType)
 
int arPattGetID2 (ARPattHandle *pattHandle, int imageProcMode, int pattDetectMode, ARUint8 *image, int xsize, int ysize, AR_PIXEL_FORMAT pixelFormat, ARParamLTf *paramLTf, ARdouble vertex[4][2], ARdouble pattRatio, int *codePatt, int *dirPatt, ARdouble *cfPatt, int *codeMatrix, int *dirMatrix, ARdouble *cfMatrix, const AR_MATRIX_CODE_TYPE matrixCodeType)
 Match the interior of a detected square against known patterns. More...
 
int arPattGetIDGlobal (ARPattHandle *pattHandle, int imageProcMode, int pattDetectMode, ARUint8 *image, int xsize, int ysize, AR_PIXEL_FORMAT pixelFormat, ARParamLTf *paramLTf, 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)
 Match the interior of a detected square against known patterns with variable border width. More...
 
int arPattGetImage (int imageProcMode, int pattDetectMode, int patt_size, int sample_size, ARUint8 *image, int xsize, int ysize, AR_PIXEL_FORMAT pixelFormat, int *x_coord, int *y_coord, int *vertex, ARdouble pattRatio, ARUint8 *ext_patt)
 
int arPattGetImage2 (int imageProcMode, int pattDetectMode, int patt_size, int sample_size, ARUint8 *image, int xsize, int ysize, AR_PIXEL_FORMAT pixelFormat, ARParamLTf *paramLTf, ARdouble vertex[4][2], ARdouble pattRatio, ARUint8 *ext_patt)
 Extract the image (i.e. locate and unwarp) of the pattern-space portion of a detected square. More...
 
int arPattGetImage3 (ARHandle *arHandle, int markerNo, ARUint8 *image, ARPattRectInfo *rect, int xsize, int ysize, int overSampleScale, ARUint8 *outImage)
 Extract the image (i.e. locate and unwarp) of an arbitrary portion of a detected square. More...
 

Variables

const signed char hamming63DecoderTable [64]
 
const bool hamming63DecoderTableErrorCorrected [64]
 
const signed char parity65DecoderTable [64]
 

Macro Definition Documentation

◆ _0_0

#define _0_0   0.0

◆ _0_5

#define _0_5   0.5

◆ _100_0

#define _100_0   100.0

◆ _10_0

#define _10_0   10.0

◆ _1_0

#define _1_0   1.0

◆ _2_0

#define _2_0   2.0

◆ _30_0

#define _30_0   30.0

◆ AR_GLOBAL_ID_INNER_SIZE

#define AR_GLOBAL_ID_INNER_SIZE   3

◆ AR_GLOBAL_ID_OUTER_SIZE

#define AR_GLOBAL_ID_OUTER_SIZE   14

◆ CLAMP

#define CLAMP (   x,
  r1,
  r2 
)    (MIN(MAX(x,r1),r2))

◆ MAX

#define MAX (   x,
 
)    (x > y ? x : y)

◆ MIN

#define MIN (   x,
 
)    (x < y ? x : y)

◆ SQRT

#define SQRT   sqrt

◆ SQRT_3_0

#define SQRT_3_0   1.7320508

Function Documentation

◆ arPattGetID()

int arPattGetID ( ARPattHandle pattHandle,
int  imageProcMode,
int  pattDetectMode,
ARUint8 image,
int  xsize,
int  ysize,
AR_PIXEL_FORMAT  pixelFormat,
int *  x_coord,
int *  y_coord,
int *  vertex,
ARdouble  pattRatio,
int *  code,
int *  dir,
ARdouble cf,
const AR_MATRIX_CODE_TYPE  matrixCodeType 
)
Here is the call graph for this function:

◆ arPattGetID2()

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 
)

Match the interior of a detected square against known patterns.

Parameters
pattHandleHandle contained details of known patterns, i.e. loaded templates, or valid barcode IDs.
imageProcModeSee discussion of arSetImageProcMode().
pattDetectModeSee discussion of arSetPatternDetectionMode().
imagePointer to packed raw image data.
xsizeHorizontal pixel dimension of raw image data.
ysizeVertical pixel dimension of raw image data.
pixelFormatPixel format of raw image data.
arParamLTfLookup table for the camera parameters for the optical source from which the image was acquired. See arParamLTCreate.
vertex4x2 array of points which correspond to the x and y locations of the corners of the detected marker square.
pattRatioA value between 0.0 and 1.0, representing the proportion of the marker width which constitutes the pattern. In earlier versions, this value was fixed at 0.5.
codePattWhere the pattern matching mode includes template (picture) matching, and a valid template is matched, the ID of the pattern from pattHandle, or -1 if not identified.
dirPattWhere the pattern matching mode includes template (picture) matching, and a valid template is matched, the direction (up, right, down, left) of the pattern from pattHandle.
cfPattWhere the pattern matching mode includes template (picture) matching, and a valid template is matched, the confidence factor of the match (range [0.0 - 1.0]).
codeMatrixWhere the pattern matching mode includes matrix (barcode) matching, and a valid matrix is matched, the ID of the pattern, or -1 if not identified.
dirMatrixWhere the pattern matching mode includes matrix (barcode) matching, and a valid matrix is matched, the direction (up, right, down, left) of the pattern.
cfMatrixWhere the pattern matching mode includes matrix (barcode) matching, and a valid matrix is matched, the confidence factor of the match (range [0.0 - 1.0]).
matrixCodeTypeWhen matrix code pattern detection mode is active, indicates the type of matrix code to detect.
Returns
0 if the function was able to correctly match, or -1 in case of error or no match.
See also
arParamLTCreate
Here is the call graph for this function:

◆ arPattGetIDGlobal()

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 
)

Match the interior of a detected square against known patterns with variable border width.

Parameters
pattHandleHandle contained details of known patterns, i.e. loaded templates, or valid barcode IDs.
imageProcModeSee discussion of arSetImageProcMode().
pattDetectModeSee discussion of arSetPatternDetectionMode().
imagePointer to packed raw image data.
xsizeHorizontal pixel dimension of raw image data.
ysizeVertical pixel dimension of raw image data.
pixelFormatPixel format of raw image data.
arParamLTfLookup table for the camera parameters for the optical source from which the image was acquired. See arParamLTCreate.
vertex4x2 array of points which correspond to the x and y locations of the corners of the detected marker square.
pattRatioA value between 0.0 and 1.0, representing the proportion of the marker width which constitutes the pattern. In earlier versions, this value was fixed at 0.5.
codePattWhere the pattern matching mode includes template (picture) matching, and a valid template is matched, the ID of the pattern from pattHandle, or -1 if not identified.
dirPattWhere the pattern matching mode includes template (picture) matching, and a valid template is matched, the direction (up, right, down, left) of the pattern from pattHandle.
cfPattWhere the pattern matching mode includes template (picture) matching, and a valid template is matched, the confidence factor of the match (range [0.0 - 1.0]).
codeMatrixWhere the pattern matching mode includes matrix (barcode) matching, and a valid matrix is matched, the ID of the pattern, or -1 if not identified.
dirMatrixWhere the pattern matching mode includes matrix (barcode) matching, and a valid matrix is matched, the direction (up, right, down, left) of the pattern.
cfMatrixWhere the pattern matching mode includes matrix (barcode) matching, and a valid matrix is matched, the confidence factor of the match (range [0.0 - 1.0]).
matrixCodeTypeWhen matrix code pattern detection mode is active, indicates the type of matrix code to detect.
errorCorrectedPointer to an integer which will be filled out with the number of errors detected and corrected during marker identification, or NULL if this information is not required.
codeGlobalID_pPointer to uint64_t which will be filled out with the global ID, or NULL if this value is not required.
Returns
0 if the function was able to correctly match, or -1 in case of error or no match.
See also
arParamLTCreate
Here is the call graph for this function:

◆ arPattGetImage()

int arPattGetImage ( int  imageProcMode,
int  pattDetectMode,
int  patt_size,
int  sample_size,
ARUint8 image,
int  xsize,
int  ysize,
AR_PIXEL_FORMAT  pixelFormat,
int *  x_coord,
int *  y_coord,
int *  vertex,
ARdouble  pattRatio,
ARUint8 ext_patt 
)

◆ arPattGetImage2()

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 
)

Extract the image (i.e. locate and unwarp) of the pattern-space portion of a detected square.

Parameters
imageProcModeSee discussion of arSetImageProcMode().
pattDetectModeSee discussion of arSetPatternDetectionMode().
patt_sizeThe number of horizontal and vertical units to subdivide the pattern-space into.
sample_sizeAt present, must always be the square of patt_size.
imagePointer to packed raw image data.
xsizeHorizontal pixel dimension of raw image data.
ysizeVertical pixel dimension of raw image data.
pixelFormatPixel format of raw image data.
arParamLTfLookup table for the camera parameters for the optical source from which the image was acquired. See arParamLTCreate.
vertex4x2 array of points which correspond to the x and y locations of the corners of the detected marker square.
pattRatioA value between 0.0 and 1.0, representing the proportion of the marker width which constitutes the pattern. In earlier versions, this value was fixed at 0.5.
ext_pattPointer to an array of appropriate size (i.e. patt_size*patt_size*3), which will be filled with the extracted image. Where a colour image is available, it will be supplied in BGR byte order.
Returns
0 if the function was able to correctly get the image, or -1 in case of error or no match.
See also
arParamLTCreate
Here is the call graph for this function:

◆ arPattGetImage3()

int arPattGetImage3 ( ARHandle arHandle,
int  markerNo,
ARUint8 image,
ARPattRectInfo rect,
int  xsize,
int  ysize,
int  overSampleScale,
ARUint8 outImage 
)

Extract the image (i.e. locate and unwarp) of an arbitrary portion of a detected square.

Use this function to obtain an image of the marker pattern space for display to the user.

Parameters
arHandleThe ARHandle structure associated with the current tracking data.
markerNoThe marker number (in range 0 to arHandle->marker_num - 1, inclusive) from which to extract the pattern.
imageThe source video image.
rectPointer to an ARPattRectInfo structure which defines the portion of the marker image to extract.
xsizeWidth of the output image, in pixels.
ysizeHeight of the output image, in pixels.
overSampleScaleNumber of samples to acquire per destination pixel, e.g. 2.
outImagePointer to a buffer, at least xsize*ysize*arUtilGetPixelSize(arHandle->arPixelFormat) bytes in size, which will be filled out with the marker image.
Returns
0 if the function was able to correctly get the image, or -1 in case of error or no match.
See also
ARPattRectInfo
Here is the call graph for this function:

Variable Documentation

◆ hamming63DecoderTable

const signed char hamming63DecoderTable[64]
Initial value:
= {
0, 0, 0, 1, 0, 1, 1, 1, 0, 2, 4, -1, -1, 5, 3, 1,
0, 2, -1, 6, 7, -1, 3, 1, 2, 2, 3, 2, 3, 2, 3, 3,
0, -1, 4, 6, 7, 5, -1, 1, 4, 5, 4, 4, 5, 5, 4, 5,
7, 6, 6, 6, 7, 7, 7, 6, -1, 2, 4, 6, 7, 5, 3, -1}

◆ hamming63DecoderTableErrorCorrected

const bool hamming63DecoderTableErrorCorrected[64]
Initial value:
= {
0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 0, 1, 1, 1,
1, 1, 0, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 0, 1,
1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 0, 1, 1,
1, 1, 1, 0, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0}

◆ parity65DecoderTable

const signed char parity65DecoderTable[64]
Initial value:
= {
0, -1, -1, 3, -1, 5, 6, -1, -1, 9, 10, -1, 12, -1, -1, 15,
-1, 17, 18, -1, 20, -1, -1, 23, 24, -1, -1, 27, -1, 29, 30, -1,
-1, 1, 2, -1, 4, -1, -1, 7, 8, -1, -1, 11, -1, 13, 14, -1,
16, -1, -1, 19, -1, 21, 22, -1, -1, 25, 26, -1, 28, -1, -1, 31}