VPI - Vision Programming Interface

2.0 Release - Developer Preview

Image Histogram

Computes image histogram from the input image. More...


VPIStatus vpiCreateHistogramEven (uint64_t backends, VPIImageFormat fmt, float start, float end, int32_t numBins, VPIPayload *payload)
 Creates payload for Image Histogram Even algorithm. More...
VPIStatus vpiSubmitHistogram (VPIStream stream, uint64_t backend, VPIPayload payload, VPIImage input, VPIArray output, uint64_t flags)
 Computes the image histogram. More...

Detailed Description

Computes image histogram from the input image.

Refer to Image Histogram for more details and usage examples.

Function Documentation

◆ vpiCreateHistogramEven()

VPIStatus vpiCreateHistogramEven ( uint64_t  backends,
VPIImageFormat  fmt,
float  start,
float  end,
int32_t  numBins,
VPIPayload payload 

#include <vpi/algo/Histogram.h>

Creates payload for Image Histogram Even algorithm.

It calculates the image histogram assuming uniform (even) bins.

[in]backendsVPI backends that are eligible to execute the algorithm.
[in]fmtFormat of input image.
[in]startSpecifies the low end of the histogram range (inclusive).
  • Must be <= end.
[in]endSpecifies the high end of the histogram range (exclusive).
  • Must be >= start.
[in]numBinsSpecifies the number of bins in the output array.
[out]payloadPointer to the payload variable that receives the created handle.
Return values
VPI_ERROR_INVALID_ARGUMENTMaximum allowed numBins for given fmt outside valid range.
VPI_ERROR_INVALID_ARGUMENTInvalid start and end values.
VPI_ERROR_INVALID_ARGUMENTbackends refers to an invalid backend.
VPI_ERROR_NOT_IMPLEMENTEDHistogram Even algorithm is not supported by given backends.
VPI_ERROR_INVALID_CONTEXTCurrent context was destroyed.
VPI_IMAGE_FORMAT_INVALIDfmt is not supported.
VPI_ERROR_OUT_OF_MEMORYCannot allocate required resources.
VPI_ERROR_INVALID_OPERATIONBackend isn't enabled in current context.
VPI_SUCCESSOperation executed successfully.

◆ vpiSubmitHistogram()

VPIStatus vpiSubmitHistogram ( VPIStream  stream,
uint64_t  backend,
VPIPayload  payload,
VPIImage  input,
VPIArray  output,
uint64_t  flags 

#include <vpi/algo/Histogram.h>

Computes the image histogram.

[in]streamThe stream where the operation will be queued in.
  • Must not be NULL.
  • Stream must have enabled the backends that will execute the algorithm.
[in]backendBackend that will execute the algorithm.
  • Must be the backend specified during payload creation or 0 as a shorthand to use this backend.
[in]payloadPayload created by vpiCreateHistogramEven.
[in]inputInput image.
  • Must not be NULL.
  • Must have same format as the one specified during payload creation.
  • Image must have enabled the backends that will execute the algorithm.
[out]outputWhere the resulting image histogram will be written to.
  • Must not be NULL.
  • Array's capacity must be greater or equal than the number of bins configured in the payload.
  • Array must have enabled the backends that will execute the algorithm.
[in]flagsControl flags.
  • Valid values are a combination of one or more of the following flags:
Return values
VPI_ERROR_INVALID_ARGUMENTpayload not created by vpiCreateHistogramEven.
VPI_ERROR_INVALID_ARGUMENToutput array's capacity outside valid range.
VPI_ERROR_INVALID_ARRAY_TYPEoutput array type not supported.
VPI_ERROR_INVALID_IMAGE_FORMATinput image format does not match with one associated with payload.
VPI_ERROR_INVALID_OPERATIONThe needed backends aren't enabled in stream, input or output.
VPI_SUCCESSOperation executed successfully.