Simd Library Documentation.

Home | Release Notes | Download | Documentation | Issues | GitHub
HOG (Histogram of Oriented Gradients)

Functions for extraction and processing of HOG features. More...

Functions

SIMD_API void SimdHogDirectionHistograms (const uint8_t *src, size_t stride, size_t width, size_t height, size_t cellX, size_t cellY, size_t quantization, float *histograms)
 Calculates HOG direction histograms for 8-bit gray image. More...
 
SIMD_API void SimdHogExtractFeatures (const uint8_t *src, size_t stride, size_t width, size_t height, float *features)
 Extracts HOG features for 8-bit gray image. More...
 
SIMD_API void SimdHogDeinterleave (const float *src, size_t srcStride, size_t width, size_t height, size_t count, float **dst, size_t dstStride)
 Separates one interleaved 32-bit float point image to separate planes. More...
 
SIMD_API void SimdHogFilterSeparable (const float *src, size_t srcStride, size_t width, size_t height, const float *rowFilter, size_t rowSize, const float *colFilter, size_t colSize, float *dst, size_t dstStride, int add)
 Applies separable filter to given image of 32-bit float point format. More...
 
template<template< class > class A>
SIMD_INLINE void HogExtractFeatures (const View< A > &src, float *features)
 Extracts HOG features for 8-bit gray image. More...
 

Detailed Description

Functions for extraction and processing of HOG features.

Function Documentation

◆ SimdHogDirectionHistograms()

void SimdHogDirectionHistograms ( const uint8_t *  src,
size_t  stride,
size_t  width,
size_t  height,
size_t  cellX,
size_t  cellY,
size_t  quantization,
float *  histograms 
)

Calculates HOG direction histograms for 8-bit gray image.

Calculates HOG direction histogram for every cell of 8-bit gray image. This function is useful for face recognition.

Note
This function has a C++ wrapper Simd::HogDirectionHistograms(const View<A> & src, const Point<ptrdiff_t> & cell, size_t quantization, float * histograms).
Parameters
[in]src- a pointer to pixels data of input 8-bit gray image.
[in]stride- a row size of the image.
[in]width- an image width. It must be a multiple of cellX.
[in]height- an image height. It must be a multiple of cellY.
[in]cellX- a width of cell.
[in]cellY- a height of cell.
[in]quantization- a direction quantization. Must be even.
[out]histograms- a pointer to buffer with histograms. Array must has size grater or equal to (width/cellX)*(height/cellY)*quantization.

◆ SimdHogExtractFeatures()

void SimdHogExtractFeatures ( const uint8_t *  src,
size_t  stride,
size_t  width,
size_t  height,
float *  features 
)

Extracts HOG features for 8-bit gray image.

Extracts HOG features 8-bit gray image. 31 features are extracted for 8x8 cell size and 2x2 block size. This function is useful for face recognition.

Note
This function has a C++ wrapper Simd::HogExtractFeatures(const View<A> & src, float * features).
Parameters
[in]src- a pointer to pixels data of input 8-bit gray image.
[in]stride- a row size of the image.
[in]width- an image width. It must be a multiple of 8. Its minimal value is 16.
[in]height- an image height. It must be a multiple of 8. Its minimal value is 16.
[out]features- a pointer to buffer with features. Array must has size grater or equal to (width/8)*(height/8)*31.

◆ SimdHogDeinterleave()

void SimdHogDeinterleave ( const float *  src,
size_t  srcStride,
size_t  width,
size_t  height,
size_t  count,
float **  dst,
size_t  dstStride 
)

Separates one interleaved 32-bit float point image to separate planes.

Parameters
[in]src- a pointer to the input interleaved 32-bit float point image.
[in]srcStride- a row size of input image.
[in]width- a width of input and output images.
[in]height- a height of input and output images.
[in]count- the number of output planes.
[out]dst- a pointer to array with pointers to output planes.
[in]dstStride- a row size of output images.

◆ SimdHogFilterSeparable()

void SimdHogFilterSeparable ( const float *  src,
size_t  srcStride,
size_t  width,
size_t  height,
const float *  rowFilter,
size_t  rowSize,
const float *  colFilter,
size_t  colSize,
float *  dst,
size_t  dstStride,
int  add 
)

Applies separable filter to given image of 32-bit float point format.

For every point (except border):

sum = 0;
for(dy = 0; dy < colSize; dy++)
    for(dx = 0; dx < rowSize; dx++)
        sum += src[x + dx, y + dy]*colFilter[dy]*rowFilter[dx];
if(add)
    dst[x, y] += sum;
else
    dst[x, y] = sum;
Note
Input image has to have size at least not less then size of filter: (width <= rowSize and height <= colSize).
Parameters
[in]src- a pointer to input 32-bit float point image.
[in]srcStride- a row size of input image.
[in]width- a width of input image. It must be not less then size of row filter.
[in]height- a height of input image. It must be not less then size of column filter.
[in]rowFilter- a pointer to 32-bit float point array with row filter.
[in]rowSize-a size of row filter.
[in]colFilter- a pointer to 32-bit float point array with column filter.
[in]colSize-a size of column filter.
[in,out]dst- a pointer to output 32-bit float point image.
[in]dstStride- a row size of output image.
[in]add- a flag which signalizes that result has to be added to existing image.

◆ HogExtractFeatures()

void HogExtractFeatures ( const View< A > &  src,
float *  features 
)

Extracts HOG features for 8-bit gray image.

Extracts HOG features 8-bit gray image. 31 features are extracted for 8x8 cell size and 2x2 block size. This function is useful for face recognition.

Note
This function is a C++ wrapper for function SimdHogExtractFeatures.
Parameters
[in]src- an input 8-bit gray image. Its width and height must be a multiple of 8 and greater or equal to 16.
[out]features- a pointer to buffer with features. Array must has size grater or equal to (width/8)*(height/8)*31.