| ARX 1.0 The next-generation open source augmented reality toolkit.

Loading...
Searching...
No Matches
Functions
arPattLoad.c File Reference
`#include <stdio.h>`
`#include <math.h>`
`#include <ARX/AR/ar.h>`
`#include <string.h>`
`#include <ARX/ARUtil/file_utils.h>`
Include dependency graph for arPattLoad.c:

## Functions
int | arPattLoadFromBuffer (ARPattHandle *pattHandle, const char *buffer)
int | arPattLoad (ARPattHandle *pattHandle, const char *filename)
| Load a pattern file into a pattern handle.
int | arPattFree (ARPattHandle *pattHandle, int patno)
| Frees (unloads) a pattern file from memory.
int | arPattActivate (ARPattHandle *pattHandle, int patno)
| Activate a previously deactivated pattern.
int | arPattDeactivate (ARPattHandle *pattHandle, int patno)
| Deactivate a previously activated pattern.

## Function Documentation

## ◆ arPattActivate()

int arPattActivate | ( | ARPattHandle * | pattHandle,
|  | int | patno
| ) |  |

Activate a previously deactivated pattern.

When a pattern is activated, is becomes available for recognition in a scene. This is the default state for a loaded pattern.

Parameters

  pattHandle | The handle holding the loaded pattern which is to be reactivated.
  patno | The index into the pattern handle's array of patterns to the pattern to be reactivated.

Returns
  0 on success, or -1 if the pattern was already activated or no pattern was loaded.

See also
  arPattDeactivate

## ◆ arPattDeactivate()

int arPattDeactivate | ( | ARPattHandle * | pattHandle,
|  | int | patno
| ) |  |

Deactivate a previously activated pattern.

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

Parameters

  pattHandle | The handle holding the loaded pattern which is to be deactivated.
  patno | The index into the pattern handle's array of patterns to the pattern to be deactivated.

Returns
  0 on success, or -1 if the pattern was already deactivated or no pattern was loaded.

See also
  arPattActivate

## ◆ arPattFree()

int arPattFree | ( | ARPattHandle * | pattHandle,
|  | int | patno
| ) |  |

Frees (unloads) a pattern file from memory.

Unloads a pattern from a pattern handle, freeing that slot for another pattern to be loaded, if necessary.

Parameters

  pattHandle | The pattern handle to unload from.
  patno | The index into the pattern handle's array of patterns to the pattern to be unloaded.

Returns
  0 if the pattern was successfully unloaded, or -1 if there was no pattern loaded.

See also
  arPattLoad

## ◆ arPattLoad()

int arPattLoad | ( | ARPattHandle * | pattHandle,
|  | const char * | filename
| ) |  |

Load a pattern file into a pattern handle.

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

Parameters

  pattHandle | Pattern handle, as generated by arPattCreateHandle(), into which the pattern file infomation will be loaded.
  filename | Pathname of pattern file to load. The pattern file is typically generated by the make_patt program. The pathname is relative to the current working directory, which is operating system- specific.

See also
  arPattCreateHandle
  arPattActivate
  arPattDeactivate
  arPattFree

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

Here is the call graph for this function:

## ◆ arPattLoadFromBuffer()

int arPattLoadFromBuffer | ( | ARPattHandle * | pattHandle,
|  | const char * | buffer
| ) |  |