VPI - Vision Programming Interface

1.2 Release

Histogram of Oriented Gradients

Extracts Histogram of Oriented Gradients features from input image. More...

Functions

VPIStatus vpiCreateExtractHOGFeatures (uint32_t backends, int32_t width, int32_t height, int32_t features, int32_t cellSize, int32_t numOrientations, int32_t *outNumFeatures, VPIPayload *payload)
 Create a payload for the non-batch version of HOG algorithm. More...
 
VPIStatus vpiCreateExtractHOGFeaturesBatch (uint32_t backends, int32_t maxBatchWidth, int32_t maxBatchHeight, int32_t imgWidth, int32_t imgHeight, int32_t features, int32_t cellSize, int32_t numOrientations, int32_t *outNumFeatures, VPIPayload *payload)
 Create a payload for the batch version of HOG algorithm. More...
 
VPIStatus vpiSubmitExtractHOGFeatures (VPIStream stream, uint32_t backend, VPIPayload payload, VPIImage input, VPIImage *outFeatures, int32_t numFeatures)
 Submit the HOG algorithm to the stream associated with the payload. More...
 

HOG flags

Defines what features will be returned.

#define VPI_HOG_CONTRAST_SENSITIVE   0x01
 Return contrast sensitive features.
 
#define VPI_HOG_CONTRAST_INSENSITIVE   0x02
 Return contrast insensitive features.
 
#define VPI_HOG_TEXTURE   0x04
 Return texture-related features.
 
#define VPI_HOG_ALL_FEATURES   (VPI_HOG_CONTRAST_SENSITIVE | VPI_HOG_CONTRAST_INSENSITIVE | VPI_HOG_TEXTURE)
 Helper flag to return all features.
 

Detailed Description

Extracts Histogram of Oriented Gradients features from input image.

Function Documentation

◆ vpiCreateExtractHOGFeatures()

VPIStatus vpiCreateExtractHOGFeatures ( uint32_t  backends,
int32_t  width,
int32_t  height,
int32_t  features,
int32_t  cellSize,
int32_t  numOrientations,
int32_t *  outNumFeatures,
VPIPayload payload 
)

#include <vpi/experimental/HOG.h>

Create a payload for the non-batch version of HOG algorithm.

Parameters
[in]backendsVPI backends that are eligible to execute the algorithm. Currently only one backend is accepted.
[in]width,heightDimensions of the input image to be used.
[in]featuresFlags to specify what features will be returned
[in]cellSizeCell size, typically 8 or 16 for 8x8 and 16x16 cells respectively.
[in]numOrientationsNumber of orientations used. This is typically 18.
[out]outNumFeaturesReceives the number of features that will be returned. Pass NULL if not needed.
[out]payloadPointer to memory where the created payload handle will be written to.
Returns
VPI_SUCCESS if payload was created successfully, or some other VPIStatus code in case of error.

◆ vpiCreateExtractHOGFeaturesBatch()

VPIStatus vpiCreateExtractHOGFeaturesBatch ( uint32_t  backends,
int32_t  maxBatchWidth,
int32_t  maxBatchHeight,
int32_t  imgWidth,
int32_t  imgHeight,
int32_t  features,
int32_t  cellSize,
int32_t  numOrientations,
int32_t *  outNumFeatures,
VPIPayload payload 
)

#include <vpi/experimental/HOG.h>

Create a payload for the batch version of HOG algorithm.

The input images are assumed to be laid out in memory as a 2D matrix of images. All images must have the same dimensions.

Parameters
[in]backendsVPI backends that are eligible to execute the algorithm. Currently only one backend is accepted.
[in]maxBatchWidth,maxBatchHeightMaximum number of images horizontally and vertically, respectively.
[in]imgWidth,imgHeightDimensions each of the batch images.
[in]featuresFlags to specify which features will be returned
[in]cellSizeCell size, typically 8 or 16 for 8x8 and 16x16 cells respectively.
[in]numOrientationsNumber of orientations used. This is typically 18.
[out]outNumFeaturesReceives the number of features that will be returned. Pass NULL if not needed.
[out]payloadPointer to a payload handle that will receive the allocated payload.
Returns
VPI_SUCCESS if payload was created successfully, or some other VPIStatus code in case of error.

◆ vpiSubmitExtractHOGFeatures()

VPIStatus vpiSubmitExtractHOGFeatures ( VPIStream  stream,
uint32_t  backend,
VPIPayload  payload,
VPIImage  input,
VPIImage outFeatures,
int32_t  numFeatures 
)

#include <vpi/experimental/HOG.h>

Submit the HOG algorithm to the stream associated with the payload.

It handles both batch and non-batch payloads.

Parameters
[in]streamThe stream where the operation will be queued in.
[in]backendBackend that will execute the algorithm. Must be one of the backends specified during payload creation. If 0, VPI will select one of the eligible backends from the payload that accepts the given parameters, usually the fastest one.
[in]payloadPayload to be submitted along the other parameters.
[in]inputIf using a non batch payload, this is the input image to be processed. Its dimensions must match what was passed to vpiCreateExtractHOGFeatures. If using a batch payload, the image dimensions must be a multiple of (imgWidth,imgHeight), and it must be at most (imgWidth*maxBatchWidth, imgHeight*maxBatchHeight).
[out]outFeaturesPointer to an array of images that will receive the features. The dimensions of each image must be (input.width / cellSize, input.height / cellSize). In case of batch processing, the output features position in the 2D matrix be the same position of the corresponding input image.
[in]numFeaturesNumber of images in the output array.
Returns
VPI_SUCCESS if payload was created successfully, or some other VPIStatus code in case of error.