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

Loading...
Searching...
No Matches
Functions
arImageProc.c File Reference
`#include <string.h>`
`#include <ARX/AR/arImageProc.h>`
Include dependency graph for arImageProc.c:

## Functions
ARImageProcInfo * | arImageProcInit (const int xsize, const int ysize)
| Initialise image processing.
void | arImageProcFinal (ARImageProcInfo *ipi)
| Finish image processing and free memory.
int | arImageProcLumaHist (ARImageProcInfo *ipi, const ARUint8 *__restrict dataPtr)
| Calculate luminance histogram.
unsigned char * | arImageProcGetHistImage (ARImageProcInfo *ipi)
| Get luminance histogram as an image.
int | arImageProcLumaHistAndCDF (ARImageProcInfo *ipi, const ARUint8 *__restrict dataPtr)
| Calculate image histogram and cumulative density function.
int | arImageProcLumaHistAndCDFAndPercentile (ARImageProcInfo *ipi, const ARUint8 *__restrict dataPtr, const float percentile, unsigned char *value_p)
| Calculate image histogram, cumulative density function, and luminance value at a given histogram percentile.
int | arImageProcLumaHistAndCDFAndMedian (ARImageProcInfo *ipi, const ARUint8 *__restrict dataPtr, unsigned char *value_p)
| Calculate image histogram, cumulative density function, and median luminance value.
int | arImageProcLumaHistAndOtsu (ARImageProcInfo *ipi, const ARUint8 *__restrict dataPtr, unsigned char *value_p)
| Calculate image histogram, and binarize image using Otsu's method for foreground/background separation.
int | arImageProcLumaHistAndBoxFilterWithBias (ARImageProcInfo *ipi, const ARUint8 *__restrict dataPtr, const int boxSize, const int bias)
| Calculate image histogram, and box filter image.
int | arImageProcLumaHistAndCDFAndLevels (ARImageProcInfo *ipi, const ARUint8 *__restrict dataPtr)
| Calculate image histogram, cumulative density function, and minimum and maximum luminance values.

## Function Documentation

## ◆ arImageProcFinal()

void arImageProcFinal | ( | ARImageProcInfo * | ipi | ) |

Finish image processing and free memory.

When processing is complete, the ARImageProcInfo structure should be disposed of by calling this function.

Parameters

  ipi | ARImageProcInfo structure to be disposed of, as created by arImageProcInit.

See also
  arImageProcInit

## ◆ arImageProcGetHistImage()

unsigned char * arImageProcGetHistImage | ( | ARImageProcInfo * | ipi | ) |

Get luminance histogram as an image.

Returns a pointer to a buffer containing a 256x256 8-bit grayscale texture. The texture can be uploaded to an OpenGL texture with the calls:

buf = arImageProcGetHistImage(ipi);
if (buf) {
glTexImage2D(GL_TEXTURE_2D, 0, GL_LUMINANCE, 256, 256, 0, GL_LUMINANCE, GL_UNSIGNED_BYTE, buf);
free(buf);
}
arImageProcGetHistImage
unsigned char * arImageProcGetHistImage(ARImageProcInfo *ipi)
Get luminance histogram as an image.
Definition: arImageProc.c:89

After uploading, the texture can be drawn as with any other OpenGL texture.

Parameters

  ipi | ARImageProcInfo structure holding the most recently processed histogram, as generated by arImageProcLumaHist etc.

Returns
  Pointer to the texture data.

## ◆ arImageProcInit()

ARImageProcInfo * arImageProcInit | ( | const int | xsize,
|  | const int | ysize
| ) |  |

Initialise image processing.

This function creates the ARImageProcInfo structure required for other image processing functions. The size of the image that will be processed is fixed by this call.

Parameters

  xsize | Width of the images that will be processed, in pixels.
  ysize | Height of the images that will be processed, in pixels.

Returns
  Pointer to the ARImageProcInfo structure. When processing is complete, this structure should be disposed of by calling arImageProcFinal.

See also
  arImageProcFinal

## ◆ arImageProcLumaHist()

int arImageProcLumaHist | ( | ARImageProcInfo * | ipi,
|  | const ARUint8 *__restrict | dataPtr
| ) |  |

Calculate luminance histogram.

Parameters

  ipi | ARImageProcInfo structure describing the format of the image to be processed, as created by arImageProcInit.

On macOS and iOS, the calculation is accelerated using the Accelerate framework.

Returns
  0 in case of success, or a value less than 0 in case of error.

## ◆ arImageProcLumaHistAndBoxFilterWithBias()

int arImageProcLumaHistAndBoxFilterWithBias | ( | ARImageProcInfo * | ipi,
|  | const ARUint8 *__restrict | dataPtr,
|  | const int | boxSize,
|  | const int | bias
| ) |  |

Calculate image histogram, and box filter image.

See https://developer.apple.com/library/ios/documentation/Performance/Reference/vImage_convolution/ On macOS and iOS, the calculation is accelerated using the Accelerate framework.

Parameters

  ipi | ARImageProcInfo structure describing the format of the image to be processed, as created by arImageProcInit.

Returns
  0 in case of success, or a value less than 0 in case of error.

Here is the call graph for this function:

## ◆ arImageProcLumaHistAndCDF()

int arImageProcLumaHistAndCDF | ( | ARImageProcInfo * | ipi,
|  | const ARUint8 *__restrict | dataPtr
| ) |  |

Calculate image histogram and cumulative density function.

Parameters

  ipi | ARImageProcInfo structure describing the format of the image to be processed, as created by arImageProcInit.

Returns
  0 in case of success, or a value less than 0 in case of error.

Here is the call graph for this function:

## ◆ arImageProcLumaHistAndCDFAndLevels()

int arImageProcLumaHistAndCDFAndLevels | ( | ARImageProcInfo * | ipi,
|  | const ARUint8 *__restrict | dataPtr
| ) |  |

Calculate image histogram, cumulative density function, and minimum and maximum luminance values.

Parameters

  ipi | ARImageProcInfo structure describing the format of the image to be processed, as created by arImageProcInit.

Returns
  0 in case of success, or a value less than 0 in case of error.

Here is the call graph for this function:

## ◆ arImageProcLumaHistAndCDFAndMedian()

int arImageProcLumaHistAndCDFAndMedian | ( | ARImageProcInfo * | ipi,
|  | const ARUint8 *__restrict | dataPtr,
|  | unsigned char * | value_p
| ) |  |

Calculate image histogram, cumulative density function, and median luminance value.

Parameters

  ipi | ARImageProcInfo structure describing the format of the image to be processed, as created by arImageProcInit.

Returns
  0 in case of success, or a value less than 0 in case of error.

Here is the call graph for this function:

## ◆ arImageProcLumaHistAndCDFAndPercentile()

int arImageProcLumaHistAndCDFAndPercentile | ( | ARImageProcInfo * | ipi,
|  | const ARUint8 *__restrict | dataPtr,
|  | const float | percentile,
|  | unsigned char * | value_p
| ) |  |

Calculate image histogram, cumulative density function, and luminance value at a given histogram percentile.

Parameters

  ipi | ARImageProcInfo structure describing the format of the image to be processed, as created by arImageProcInit.

Returns
  0 in case of success, or a value less than 0 in case of error.

Here is the call graph for this function:

## ◆ arImageProcLumaHistAndOtsu()

int arImageProcLumaHistAndOtsu | ( | ARImageProcInfo * | ipi,
|  | const ARUint8 *__restrict | dataPtr,
|  | unsigned char * | value_p
| ) |  |

Calculate image histogram, and binarize image using Otsu's method for foreground/background separation.

    See http://en.wikipedia.org/wiki/Otsu's_method fore more information.

Parameters

  ipi | ARImageProcInfo structure describing the format of the image to be processed, as created by arImageProcInit.

Returns
  0 in case of success, or a value less than 0 in case of error.

Here is the call graph for this function: