DriveWorks SDK Reference 3.0.4260 Release For Test and Development only
Filtering
Note
SW Release Applicability: This module is available in both NVIDIA DriveWorks and NVIDIA DRIVE Software releases.

The Filtering module provides three functionalities: Pyramid computing, Thresholding, and Image filtering.

### Pyramid

The input to the Tracking module are Gaussian Pyramids of single channel frames, e.g. the Y channel of an YUV image. Memory for it is allocated during dwPyramid_create(), which also specifies the number of levels. Each level has the quarter resolution of the previous level, e.g. 1280x800, 640x400, 320x200 for a 3-level pyramid and camera resolution of 1280x800. Each created pyramid is meant to be reused and is updated via the dwImageFilter_computePyramid(). This module can be accelerated using the Programmable Vision Accelerator(PVA). When using PVA dwPyramidPVA_create() and dwPyramidPVA_computePyramid() have to be used respectively to allocate memory and update pyramids.

### Thresholding

The thresholding operation allows to set individual groups of pixels to a specific pixel value, based on a simple comparison criterion. The simples thresholding consists of setting all pixels greater than a value X to a maximum value MAXVAL and keeping the rest as is.

The dwThresholdParameters describe how the thresholding will take place.
There are 3 modes described in dwThresholdMode:

• DW_THRESHOLD_MODE_SIMPLE compares all pixels to a single value selected manually
• DW_THRESHOLD_MODE_OTSU similar to the above, but the value is automatically computed and set, based on the global contrast values of the image. If the histogram of the image is bimodal, then the result is the segmentation in 2 distinct classes
• DW_THRESHOLD_MODE_PER_PIXEL each pixel is individually compared to each pixel of the image dwThresholdParameters.thresholdingImage of the same size as the image. If thresholdingImage is the obtained by gaussian filtering the original image, then the operation is called Adaptive Gaussian Thresholding (see OpenCV's cv2.adaptiveThreshold)

The comparison of the pixels can be done with > or < sign, depending on the value of dwThresholdParameters.inverse, if it's false then the copmarison between PIX and TRSH is PIX > TRSH -> X otherwise it is PIX < TRSH -> X where X depends on the chosen behavior described in dwThresholdBehavior:

• DW_THRESHOLD_BEHAVIOR_BINARY if the result of the comparison is true, then X is dwThresholdParameters.maxVal other wise it is 0
• DW_THRESHOLD_BEHAVIOR_TRUNCATE if the result of the comparison is true, then X is TRSH otherwise PIX
• DW_THRESHOLD_BEHAVIOR_TO_ZERO if the result of the comparison is true, then X is PIX otherwise 0

### ImageFilter

Image filtering allows you to apply various effects on images. This module implements three types of filtering: Recursive Gaussian filter, Box filter, and Convolution filter.

The dwImageFilterType indicates the types of filtering.

• DW_IMAGEFILTER_TYPE_RECURSIVE_GAUSSIAN_FILTER The recursive implementation of Gaussian filter, the filter coefficients have a closed-form solution as a function of scale (/spl sigma/) and recursion order N (N=0, 1, 2).
• DW_IMAGEFILTER_TYPE_BOX_FILTER The Box Filter algorithm blurs an image using windowWidth×windowHeight normalized averaging kernel. Filter anchor point is center of the kernel.
• DW_IMAGEFILTER_TYPE_CONVOLUTION_FILTER The Convolution algorithm performs a 2D convolution operation on the input image with the provided kernel. The functionality supports both 2D kernels and separable 1D kernels. While executing PVA Convolution filter, pxlType need to be set to corresponding data type of input&output image. Its value is described in dwTrivialDataType, and current PVA engine supports data type INT8, UINT8, INT16 and UINT16 only.

The dwImageFilterConfig describes how the filtering will take place.

• dwImageFilterConfig.processorType indicates what processor handles image filter. For user defined kernel:
• dwImageFilterConfig.kernelWidth and dwImageFilterConfig.kernelHeight indicate the width and height of kernel.
• dwImageFilterConfig.kernelLength indicates size of dwImageFilterConfig.kernel which points to a float32_t data. For 2D Conv, the kernelLength equals kernelWidth x kernelHeight. For Separable Conv, the kernelLength equals to kernelWidth + kernelHeight.