| 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.
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.
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.
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.

## 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,
|  |  | y
| ) |  | (x > y ? x : y)

## ◆ MIN

#define MIN | ( |  | x,
|  |  | y
| ) |  | (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

  pattHandle | Handle contained details of known patterns, i.e. loaded templates, or valid barcode IDs.
  imageProcMode | See discussion of arSetImageProcMode().
  pattDetectMode | See discussion of arSetPatternDetectionMode().
  image | Pointer to packed raw image data.
  xsize | Horizontal pixel dimension of raw image data.
  ysize | Vertical pixel dimension of raw image data.
  pixelFormat | Pixel format of raw image data.
  arParamLTf | Lookup table for the camera parameters for the optical source from which the image was acquired. See arParamLTCreate.
  vertex | 4x2 array of points which correspond to the x and y locations of the corners of the detected marker square.
  pattRatio | A 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.
  codePatt | Where 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.
  dirPatt | Where 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.
  cfPatt | Where 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]).
  codeMatrix | Where the pattern matching mode includes matrix (barcode) matching, and a valid matrix is matched, the ID of the pattern, or -1 if not identified.
  dirMatrix | Where the pattern matching mode includes matrix (barcode) matching, and a valid matrix is matched, the direction (up, right, down, left) of the pattern.
  cfMatrix | Where 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]).
  matrixCodeType | When 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

  pattHandle | Handle contained details of known patterns, i.e. loaded templates, or valid barcode IDs.
  imageProcMode | See discussion of arSetImageProcMode().
  pattDetectMode | See discussion of arSetPatternDetectionMode().
  image | Pointer to packed raw image data.
  xsize | Horizontal pixel dimension of raw image data.
  ysize | Vertical pixel dimension of raw image data.
  pixelFormat | Pixel format of raw image data.
  arParamLTf | Lookup table for the camera parameters for the optical source from which the image was acquired. See arParamLTCreate.
  vertex | 4x2 array of points which correspond to the x and y locations of the corners of the detected marker square.
  pattRatio | A 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.
  codePatt | Where 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.
  dirPatt | Where 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.
  cfPatt | Where 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]).
  codeMatrix | Where the pattern matching mode includes matrix (barcode) matching, and a valid matrix is matched, the ID of the pattern, or -1 if not identified.
  dirMatrix | Where the pattern matching mode includes matrix (barcode) matching, and a valid matrix is matched, the direction (up, right, down, left) of the pattern.
  cfMatrix | Where 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]).
  matrixCodeType | When matrix code pattern detection mode is active, indicates the type of matrix code to detect.
  errorCorrected | Pointer 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_p | Pointer 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

  imageProcMode | See discussion of arSetImageProcMode().
  pattDetectMode | See discussion of arSetPatternDetectionMode().
  patt_size | The number of horizontal and vertical units to subdivide the pattern-space into.
  sample_size | At present, must always be the square of patt_size.
  image | Pointer to packed raw image data.
  xsize | Horizontal pixel dimension of raw image data.
  ysize | Vertical pixel dimension of raw image data.
  pixelFormat | Pixel format of raw image data.
  arParamLTf | Lookup table for the camera parameters for the optical source from which the image was acquired. See arParamLTCreate.
  vertex | 4x2 array of points which correspond to the x and y locations of the corners of the detected marker square.
  pattRatio | A 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_patt | Pointer 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

  arHandle | The ARHandle structure associated with the current tracking data.
  markerNo | The marker number (in range 0 to arHandle->marker_num - 1, inclusive) from which to extract the pattern.
  image | The source video image.
  rect | Pointer to an ARPattRectInfo structure which defines the portion of the marker image to extract.
  xsize | Width of the output image, in pixels.
  ysize | Height of the output image, in pixels.
  overSampleScale | Number of samples to acquire per destination pixel, e.g. 2.
  outImage | Pointer 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}