# Histogram Of Gradients

- enum fadasHOGNormMethod

    - Defines the normalization method in the HOG extraction process.

*Values:*

- enumerator FADAS\_HOG\_NORM\_REGULAR

    - Regular normalization method.

- enumerator FADAS\_HOG\_NORM\_RENORMALIZATION

    - Re-normalization.

- enumerator FADAS\_HOG\_NORM\_FHOG

    - F-HOG method.

- enumerator FADAS\_HOG\_NORM\_END

    - Check invalid enum values.

- enumerator FADAS\_HOG\_NORM\_MAX

    - Do not use.

- [FadasError\_e](https://docs.qualcomm.com/doc/80-63309-1/topic/enum_fadas_8h_1a280abf443019bfc722ac1158e5fe1013.html#_CPPv412FadasError_e) FadasHOG\_Init(const char \*licenseKey)

    - Initialize the HOG module. **WARNING:** Must be called once before other FastADAS functions except [FadasVersion()](https://docs.qualcomm.com/doc/80-63309-1/topic/misc.html#group__misc_1ga55cbdff48d751f2a0227ae4ac106d746).

- Parameters:

    - **licenseKey** – Pointer to the license key string.

- Returns:

    - [FADAS\_ERROR\_NONE](https://docs.qualcomm.com/doc/80-63309-1/topic/enum_fadas_8h_1a280abf443019bfc722ac1158e5fe1013.html#fadas_8h_1a280abf443019bfc722ac1158e5fe1013aea09a4171f0866f38326d7e5323f2d12) — Success.

- [FadasError\_e](https://docs.qualcomm.com/doc/80-63309-1/topic/enum_fadas_8h_1a280abf443019bfc722ac1158e5fe1013.html#_CPPv412FadasError_e) FadasHOG\_DeInit(void)

    - Deinitialize the HOG module. **WARNING:** Must be called once after all other FastADAS functions except [FadasVersion()](https://docs.qualcomm.com/doc/80-63309-1/topic/misc.html#group__misc_1ga55cbdff48d751f2a0227ae4ac106d746).

- Returns:

    - [FADAS\_ERROR\_NONE](https://docs.qualcomm.com/doc/80-63309-1/topic/enum_fadas_8h_1a280abf443019bfc722ac1158e5fe1013.html#fadas_8h_1a280abf443019bfc722ac1158e5fe1013aea09a4171f0866f38326d7e5323f2d12) — Success.

- [FadasError\_e](https://docs.qualcomm.com/doc/80-63309-1/topic/enum_fadas_8h_1a280abf443019bfc722ac1158e5fe1013.html#_CPPv412FadasError_e) FadasHOG\_Create(uint32\_t width, uint32\_t height, uint32\_t cellSize, uint32\_t blockSize, uint32\_t blockStep, uint32\_t binSize, [fadasHOGNormMethod](https://docs.qualcomm.com/doc/80-63309-1/topic/enum_group__hog_1ga0bfc1c7d80da650ea52aa4141ca96551.html#_CPPv418fadasHOGNormMethod) normMethod, uint32\_t \*vecLength, void \*\*hogHandle)

    - Create the HOG vector and calculate the length of the output vector for HOG extraction.

- Parameters:

    - - **width** – Input window width.
- **height** – Input window height.
- **cellSize** – The size of one cell in pixels. The typical cell size is four.
- **blockSize** – Block size in pixels; must be a multiple of cellSize. **WARNING:** When the normMethod parameter is [FADAS\_HOG\_NORM\_FHOG](https://docs.qualcomm.com/doc/80-63309-1/topic/histogram-of-gradients.html#group__hog_1gga0bfc1c7d80da650ea52aa4141ca96551a271051afa5526bf2888362a0ca62f740), the blockStep parameter is by default equal to the cellSize parameter.
- **blockStep** – Block step in pixels when sliding the block over the image. If the blockStep is a multiple of cellSize, faster approach would be taken when normMethod is [FADAS\_HOG\_NORM\_REGULAR](https://docs.qualcomm.com/doc/80-63309-1/topic/histogram-of-gradients.html#group__hog_1gga0bfc1c7d80da650ea52aa4141ca96551a2d91fbd7515e61af80ae50b613d58a3b) or [FADAS\_HOG\_NORM\_RENORMALIZATION](https://docs.qualcomm.com/doc/80-63309-1/topic/histogram-of-gradients.html#group__hog_1gga0bfc1c7d80da650ea52aa4141ca96551af4e45c19ba7a59e07485d1a9bc2b1fc2). **WARNING:** When the normMethod parameter is [FADAS\_HOG\_NORM\_FHOG](https://docs.qualcomm.com/doc/80-63309-1/topic/histogram-of-gradients.html#group__hog_1gga0bfc1c7d80da650ea52aa4141ca96551a271051afa5526bf2888362a0ca62f740), blockStep is by default equal to the cellSize parameter.
- **binSize** – Number of bins in the gradient histogram. Typical binSize is 9.
- **normMethod** – Enum parameter to specify the normalization method for the HOG descriptor construction. See [fadasHOGNormMethod()](https://docs.qualcomm.com/doc/80-63309-1/topic/histogram-of-gradients.html#group__hog_1ga0bfc1c7d80da650ea52aa4141ca96551) for details.
- **vecLength** – Pointer to the length of the HOG vector in uint32\_t.
- **hogHandle** – Handle to the HOG object.

- [FadasError\_e](https://docs.qualcomm.com/doc/80-63309-1/topic/enum_fadas_8h_1a280abf443019bfc722ac1158e5fe1013.html#_CPPv412FadasError_e) FadasHOG\_Destroy(void \*hogHandle)

    - Function to release HOG resources.

- Parameters:

    - **hogHandle** – Handle to the HOG object.

- Returns:

    - [FADAS\_ERROR\_NONE](https://docs.qualcomm.com/doc/80-63309-1/topic/enum_fadas_8h_1a280abf443019bfc722ac1158e5fe1013.html#fadas_8h_1a280abf443019bfc722ac1158e5fe1013aea09a4171f0866f38326d7e5323f2d12) — Success.

- [FadasError\_e](https://docs.qualcomm.com/doc/80-63309-1/topic/enum_fadas_8h_1a280abf443019bfc722ac1158e5fe1013.html#_CPPv412FadasError_e) FadasHOG\_Run([FadasImage\_t](https://docs.qualcomm.com/doc/80-63309-1/topic/struct_fadas_image__t.html#_CPPv412FadasImage_t) \*src, uint16\_t \*\_\_restrict hogVector, uint32\_t hogVectorLen, void \*hogHandle)

    - Extract a histogram of oriented gradients (HOG) descriptor given a grayscale image.

- Parameters:

    - - **src** – Pointer to the input grayscale image object to extract HOG descriptors.
- **hogVector** – Pointer to the output descriptor vector in uint16\_t.
- **hogVectorLen** – Length of the output descriptor vector.
- **hogHandle** – Handle to the HOG object.

- Returns:

    - [FADAS\_ERROR\_NONE](https://docs.qualcomm.com/doc/80-63309-1/topic/enum_fadas_8h_1a280abf443019bfc722ac1158e5fe1013.html#fadas_8h_1a280abf443019bfc722ac1158e5fe1013aea09a4171f0866f38326d7e5323f2d12) — Success.

- void \*FadasHOG\_CreateWorkers(uint32\_t nThreads, int32\_t pThreadsAffinity[])

    - Creates a multithreaded worker pool for the HOG feature.

- Parameters:

    - - **nThreads** – Requested number of threads; can be limited to the maximum number of threads if requesting more than that limit. The maximum is the maximum number of physical or logical cores. If requesting 0 threads, use the maximum number.
- **pThreadsAffinity** – Array to set thread affinities.

- Returns:

    - Pointer to a worker pool.

- [FadasError\_e](https://docs.qualcomm.com/doc/80-63309-1/topic/enum_fadas_8h_1a280abf443019bfc722ac1158e5fe1013.html#_CPPv412FadasError_e) FadasHOG\_DestroyWorkers(void \*wrkrs)

    - Destroys HOG worker pool.

- Parameters:

    - **wrkrs** – Worker pool created by [FadasHOG\_CreateWorkers()](https://docs.qualcomm.com/doc/80-63309-1/topic/histogram-of-gradients.html#group__hog_1gad7066cf2c0dca34dcb3ef17734a2cf07).

- Returns:

    - [FADAS\_ERROR\_NONE](https://docs.qualcomm.com/doc/80-63309-1/topic/enum_fadas_8h_1a280abf443019bfc722ac1158e5fe1013.html#fadas_8h_1a280abf443019bfc722ac1158e5fe1013aea09a4171f0866f38326d7e5323f2d12) — Success.

- [FadasError\_e](https://docs.qualcomm.com/doc/80-63309-1/topic/enum_fadas_8h_1a280abf443019bfc722ac1158e5fe1013.html#_CPPv412FadasError_e) FadasHOG\_RunMT(void \*wrkrs, [FadasImage\_t](https://docs.qualcomm.com/doc/80-63309-1/topic/struct_fadas_image__t.html#_CPPv412FadasImage_t) \*src, uint16\_t \*\_\_restrict hogVector, uint32\_t hogVectorLen, void \*hogHandle)

    - Extract a histogram of oriented gradients (HOG) descriptor given a grayscale image.

- Parameters:

    - - **wrkrs** – Worker pool created by [FadasHOG\_CreateWorkers()](https://docs.qualcomm.com/doc/80-63309-1/topic/histogram-of-gradients.html#group__hog_1gad7066cf2c0dca34dcb3ef17734a2cf07).
- **src** – Pointer to the input grayscale image object to extract HOG descriptors.
- **hogVector** – Pointer to the output descriptor vector in uint16\_t.
- **hogVectorLen** – Length of the output descriptor vector.
- **hogHandle** – Handle to the HOG object.

- Returns:

    - [FADAS\_ERROR\_NONE](https://docs.qualcomm.com/doc/80-63309-1/topic/enum_fadas_8h_1a280abf443019bfc722ac1158e5fe1013.html#fadas_8h_1a280abf443019bfc722ac1158e5fe1013aea09a4171f0866f38326d7e5323f2d12) — Success.

Last Published: Sep 30, 2024

[Previous Topic
Feature Point Tracking](https://docs.qualcomm.com/bundle/publicresource/80-63309-1/topics/feature-point-tracking.md) [Next Topic
Hungarian](https://docs.qualcomm.com/bundle/publicresource/80-63309-1/topics/hungarian.md)