VPI - Vision Programming Interface

0.2.0 Release

Gaussian Pyramid Generator

Overview

Gaussian pyramid generator takes one input image and fills the output image pyramid with downscaled versions of the input.

Input Output

Implementation

The function is implemented by generating the Gaussian pyramid from the base (level 0) to coarser levels.

If the input image actually wraps the first level of the image pyramid, nothing is done for this level. If not, the input image contents will be copied to the first image pyramid level.

The coarser levels are generated by taking the previous level, convolving it using a clamp boundary condition with the following kernel:

\[ k = \begin{bmatrix} 1 \\ 4 \\ 6 \\ 4 \\ 1 \end{bmatrix} \cdot \begin{bmatrix} 1 & 4 & 6 & 4 & 1 \end{bmatrix} \]

Because only 2x downscaling is supported, the result is then downsampled by keeping all pixels with even coordinates.

The algorithm repeats until all levels are generated.

Usage

  1. Initialization phase
    1. Include the header that defines the Gaussian pyramid generator function.
    2. Define the stream on which the algorithm will be executed and the input image.
      VPIStream stream = /*...*/;
      VPIImage input = /*...*/;
    3. Create the output pyramid with the desired number of levels and scale factor.
      uint32_t w, h;
      vpiImageGetSize(input, &w, &h);
      vpiImageGetType(input, &type);
      VPIPyramid output;
      vpiPyramidCreate(w, h, type, 4, 0.5, 0, &output);
  2. Processing phase
    1. Submit the algorithm to the stream, along with the input image and output pyramid.
      vpiSubmitGaussianPyramidGenerator(stream, input, output);
    2. Optionally, wait until the processing is done.
      vpiStreamSync(stream);

Limitations and Constraints

Constraints for specific backends supersede the ones specified for all backends.

All Backends

PVA

  • Every pyramid level's dimension must be at least 65x65 big.
  • The following input image types are accepted:
  • Pyramid must have at most 10 levels.

Performance

For further information on how performance was benchmarked, see Performance Measurement.

Jetson AGX Xavier
sizetypescalelevelsCPUCUDAPVA
1920x1080u80.54 0.65 ms0.098 msn/a
1920x1080u160.54 0.74 ms0.1130 ms1.0756 ms
Jetson TX2
sizetypescalelevelsCPUCUDAPVA
1920x1080u80.54 1.8 ms0.256 msn/a
1920x1080u160.54 2.3 ms0.255 msn/a
Jetson Nano
sizetypescalelevelsCPUCUDAPVA
1920x1080u80.54 3.441 ms0.3375 msn/a
1920x1080u160.54 3.710 ms0.463 msn/a
vpiSubmitGaussianPyramidGenerator
VPIStatus vpiSubmitGaussianPyramidGenerator(VPIStream stream, VPIImage input, VPIPyramid output)
Computes the Gaussian pyramid from the input image.
vpiPyramidCreate
VPIStatus vpiPyramidCreate(uint32_t width, uint32_t height, VPIImageType fmt, uint32_t numLevels, float scale, uint32_t flags, VPIPyramid *pyr)
Create an empty image pyramid instance with the specified flags.
VPIImageType
VPIImageType
Image formats.
Definition: Types.h:190
vpiStreamSync
VPIStatus vpiStreamSync(VPIStream stream)
Blocks the calling thread until all submitted commands in this stream queue are done (queue is empty)...
GaussianPyramidGenerator.h
VPIImage
struct VPIImageImpl * VPIImage
Definition: Types.h:170
vpiImageGetSize
VPIStatus vpiImageGetSize(VPIImage img, uint32_t *width, uint32_t *height)
Get the image size in pixels.
vpiImageGetType
VPIStatus vpiImageGetType(VPIImage img, VPIImageType *type)
Get the image type.
VPIStream
struct VPIStreamImpl * VPIStream
Definition: Types.h:164
VPIPyramid
struct VPIPyramidImpl * VPIPyramid
Definition: Types.h:176