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

ARImageProcInfoarImageProcInit (const int xsize, const int ysize)
 Initialise image processing. More...
 
void arImageProcFinal (ARImageProcInfo *ipi)
 Finish image processing and free memory. More...
 
int arImageProcLumaHist (ARImageProcInfo *ipi, const ARUint8 *__restrict dataPtr)
 Calculate luminance histogram. More...
 
unsigned char * arImageProcGetHistImage (ARImageProcInfo *ipi)
 Get luminance histogram as an image. More...
 
int arImageProcLumaHistAndCDF (ARImageProcInfo *ipi, const ARUint8 *__restrict dataPtr)
 Calculate image histogram and cumulative density function. More...
 
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. More...
 
int arImageProcLumaHistAndCDFAndMedian (ARImageProcInfo *ipi, const ARUint8 *__restrict dataPtr, unsigned char *value_p)
 Calculate image histogram, cumulative density function, and median luminance value. More...
 
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. More...
 
int arImageProcLumaHistAndBoxFilterWithBias (ARImageProcInfo *ipi, const ARUint8 *__restrict dataPtr, const int boxSize, const int bias)
 Calculate image histogram, and box filter image. More...
 
int arImageProcLumaHistAndCDFAndLevels (ARImageProcInfo *ipi, const ARUint8 *__restrict dataPtr)
 Calculate image histogram, cumulative density function, and minimum and maximum luminance values. More...
 

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
ipiARImageProcInfo 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:

if (buf) {
glTexImage2D(GL_TEXTURE_2D, 0, GL_LUMINANCE, 256, 256, 0, GL_LUMINANCE, GL_UNSIGNED_BYTE, buf);
free(buf);
}
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
ipiARImageProcInfo 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
xsizeWidth of the images that will be processed, in pixels.
ysizeHeight 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
ipiARImageProcInfo 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
ipiARImageProcInfo 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
ipiARImageProcInfo 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
ipiARImageProcInfo 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
ipiARImageProcInfo 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
ipiARImageProcInfo 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
ipiARImageProcInfo 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: