FaceDetector


Performance:

Note that all of the methods contained within this class are currently inlined in order to eliminate subroutine call overhead.

Discussion

This class contains a series of relatively basic building blocks (extensible image filtering and image comparison methods) which are intended to be linked together in order to create or extend an embedded face detection system deployable over the Cascades network.

Performance:

Note that all of the methods contained within this class are currently inlined in order to eliminate subroutine call overhead.



Member Functions

__abs
__alloc
__alloc(image_struct *, unsigned int)
__alloc(unsigned int)
__cache
__clear
__hash
__invert
__sobel
__sum
CachePixels
ComparePixels
FaceDetector
FaceDetector(image_struct *, unsigned int, unsigned int, unsigned int)
FaceDetector(unsigned int, unsigned int, unsigned int)
FilterPixels
HasFace
~FaceDetector

__abs

private

int __abs( int value)
Discussion

Computes the absolute value of the input.

Parameter Descriptions
value
Input value.
function result
Returns the absolute value of the input.

__alloc

private

void __alloc( unsigned int width, unsigned int height)
Discussion

Default image buffer allocator.

Parameter Descriptions
width
Default width of the source image buffer in pixels.
height
Default height of the source image buffer in pixels.

__alloc(image_struct *, unsigned int)

private

void __alloc( image_struct *images, unsigned int index)
Discussion

Initializes the image structure in our image buffer array at the location referenced by the specified index value with a user specified image structure.

Parameter Descriptions
images
Array of user specified image structures to initialize our image buffer array with.
index
Location in array of image structures to copy image buffer (as well as any associated state) from.

__alloc(unsigned int)

private

void __alloc( unsigned int index)
Discussion

Allocates and initializes the image structure located at the specified index value.

Parameter Descriptions
index
Image structure location to allocate and initialize in image buffer array.

__cache

private

void __cache( unsigned int index)
Discussion

Saves the source image buffer (as well as any associated state) into the array of image structures at the location referenced by the specified index value.

Parameter Descriptions
index
Location in array of image structures used to save source image buffer.

__clear

private

void __clear( void)
Discussion

Clears all pixels in the U, V (i.e. B, R luminance) channels of the source image buffer.


__hash

private

void __hash( void)
Discussion

Generates a hash value for the source image buffer.


__invert

private

void __invert( void)
Discussion

Inverts all pixels contained within the Y channel (i.e. luminance) of the source image buffer.


__sobel

private

void __sobel( void)
Discussion

Runs the Sobel convolution over all pixels contained within the Y channel (i.e. luminance) of the source image buffer.


__sum

private

void __sum( unsigned int index)
Discussion

Calculates the sum of absolute differences between the Y channels (i.e. luminance) of the source and selected image buffers.

Parameter Descriptions
index
Location in array of image buffers used for difference calculation.

CachePixels

private

void CachePixels( void)
Discussion

Saves the source image buffer (as well as any associated state) into the array of image structures.


ComparePixels

private

unsigned char* ComparePixels( void)
Discussion

Runs the implemented comparison operation (sum of absolute differences) against all pixels in the Y channel (i.e. luminance) of the selected image buffers (from the array of image structures) and the Y channel of the source image buffer.

function result
Returns a pointer to the pixels of the matching image buffer if found otherwise returns NULL.

FaceDetector

public

~FaceDetector()
Discussion

Destructor for the FaceDetector class.


FaceDetector(image_struct *, unsigned int, unsigned int, unsigned int)

public

FaceDetector( image_struct *images, unsigned int count, unsigned int width, unsigned int height) : image_count( count)
Discussion

Constructor for the FaceDetector class used to configure and initialize our image buffer array using a user specified array of image structures.

Parameter Descriptions
images
Array of user specified image structures from which to initialize our image buffer array with.
count
Default number of image structures to allocate.
width
Default width of the source image buffer in pixels.
height
Default height of the source image buffer in pixels.

FaceDetector(unsigned int, unsigned int, unsigned int)

public

FaceDetector( unsigned int count, unsigned int width, unsigned int height) : image_count( count)
Discussion

Constructor for the FaceDetector class used to configure and initialize our image buffer array using the default allocator.

Parameter Descriptions
count
Default number of image structures to allocate.
width
Default width of the source image buffer in pixels.
height
Default height of the source image buffer in pixels.

FilterPixels

private

void FilterPixels( void)
Discussion

Image post-processing stage used to filter (if necessary) the source image buffer before further processing.


HasFace

public

unsigned char* HasFace( unsigned char *pixels, unsigned int range, unsigned int width, unsigned int height, flags_struct flags)
Discussion

This routine acts as a simple wrapper around any underlying image processing (e.g. FilterPixels) and image comparison (e.g. ComparePixels) stages.

Parameter Descriptions
pixels
Pointer to the YUV 4:2:0 format source image buffer.
range
Differencing range used during image comparison.
width
Width of source image buffer in pixels.
height
Height of source image buffer in pixels.
flags
Configuration settings associated with the source image buffer.
function result
Returns a pointer to the pixels of the matching image buffer if found otherwise returns NULL.

~FaceDetector

public

~FaceDetector()
Discussion

Destructor for the FaceDetector class.


Member Data


image

private image_struct image;
Discussion

Image structure for the source image buffer.


image_buffer

private image_struct *image_buffer;
Discussion

Pointer to the array of allocated image structures.


image_count

private unsigned int image_count;
Discussion

Number of image structures to allocate.


image_diff

private unsigned int image_diff
Discussion

Differencing value returned from image buffer comparison.


image_index

private unsigned int image_index;
Discussion

Index into array of allocated image structures.


image_pixels

private unsigned char *image_pixels;
Discussion

Pointer to empty image buffer used for convolution.


image_range

private unsigned int image_range;
Discussion

Differencing range used during image buffer comparison.


(Last Updated September 12, 2006)