VPI - Vision Programming Interface

3.0 Release

Median Filter

Runs a 2D median filter over the input image. More...


VPIStatus vpiSubmitMedianFilter (VPIStream stream, uint64_t backend, VPIImage input, VPIImage output, int32_t kernelWidth, int32_t kernelHeight, const int8_t *kernelData, VPIBorderExtension border)
 Runs a 2D median filter over an image. More...

Detailed Description

Runs a 2D median filter over the input image.

Refer to Median Filter for more details and usage examples regarding Median Filter.

Function Documentation

◆ vpiSubmitMedianFilter()

VPIStatus vpiSubmitMedianFilter ( VPIStream  stream,
uint64_t  backend,
VPIImage  input,
VPIImage  output,
int32_t  kernelWidth,
int32_t  kernelHeight,
const int8_t *  kernelData,
VPIBorderExtension  border 

#include </opt/nvidia/vpi3/include/vpi/algo/MedianFilter.h>

Runs a 2D median filter over an image.

[in]streamA stream handle where the operation will be queued into.
[in]backendBackend that will execute the algorithm.
[in]inputInput image to be denoised.
[out]outputOutput image where the result is written to.
  • Must not be NULL.
  • Must have same format and dimensions as input image.
  • Image must have enabled the backends that will execute the algorithm.
[in]kernelWidth,kernelHeightKernel dimensions. The coordinate of the kernel weight that is aligned with the source pixel is given by the following formula:

\begin{align*} k_x &= \mathit{kernelWidth}/2 \\ k_y &= \mathit{kernelHeight}/2 \end{align*}

  • Must be between 1x1 and 11x11, can be non square.
[in]kernelDataMedian kernel binary mask. It defines the structuring element or median calculation mask, in row-major layout. The pixel under a non-zero kernel element be used in median calculation. Size the kernel elements are copied to an internal buffer, the given buffer can be deallocated after the call. Use NULL for all elements in median calculation, i.e. all kernel elements considered to be non-zero.
  • If not NULL, it must point to a buffer with kernelWidth * kernelHeight elements.
[in]borderHow to handle pixels outside image boundaries.
Return values
VPI_ERROR_INVALID_ARGUMENTinput and output image dimensions and formats do not match.
VPI_ERROR_INVALID_ARGUMENTImage dimensions aren't supported for given format.
VPI_ERROR_INVALID_ARGUMENTborder not supported.
VPI_ERROR_INVALID_ARGUMENTbackend is invalid or unknown.
VPI_ERROR_INVALID_IMAGE_FORMATinput and output formats aren't supported
VPI_ERROR_NOT_IMPLEMENTEDMedian filter algorithm is not supported by given backend.
VPI_ERROR_INVALID_OPERATIONBackend hardware not available.
VPI_ERROR_INVALID_OPERATIONThe needed backends aren't enabled in stream, input or output.
VPI_SUCCESSOperation executed successfully.