1 # Copyright (c) 2019-2020, NVIDIA CORPORATION. All rights reserved.
3 @page imageprocessing_filtering_mainsection Filtering
5 @note SW Release Applicability: This module is available in both **NVIDIA DriveWorks** and **NVIDIA DRIVE Software** releases.
9 The Filtering module provides three functionalities: Pyramid computing, Thresholding, and Image filtering.
13 The input to the @ref imageprocessing_tracking_mainsection 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()`.
14 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.
18 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.
20 The `dwThresholdParameters` describe how the thresholding will take place.<br>
21 There are 3 modes described in `::dwThresholdMode`:
22 - `::DW_THRESHOLD_MODE_SIMPLE` compares all pixels to a single value selected manually
23 - `::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
24 - `::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)
26 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
27 described in `::dwThresholdBehavior`:
28 - `::DW_THRESHOLD_BEHAVIOR_BINARY` if the result of the comparison is true, then X is `dwThresholdParameters.maxVal` other wise it is 0
29 - `::DW_THRESHOLD_BEHAVIOR_TRUNCATE` if the result of the comparison is true, then X is TRSH otherwise PIX
30 - `::DW_THRESHOLD_BEHAVIOR_TO_ZERO` if the result of the comparison is true, then X is PIX otherwise 0
34 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.
36 The `dwImageFilterType` indicates the types of filtering.
37 - `::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).
39 - `::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.
41 - `::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.
43 The `dwImageFilterConfig` describes how the filtering will take place.
44 - `dwImageFilterConfig.processorType` indicates what processor handles image filter.
45 For user defined kernel:
46 - `dwImageFilterConfig.kernelWidth` and `dwImageFilterConfig.kernelHeight` indicate the width and height of kernel.
47 - `dwImageFilterConfig.kernelLength` indicates size of `dwImageFilterConfig.kernel` which points to a float32_t data.
48 For 2D Conv, the kernelLength equals kernelWidth x kernelHeight.
49 For Separable Conv, the kernelLength equals to kernelWidth + kernelHeight.
53 - @ref imageprocessing_tracking_usecase1
54 - @ref dwx_image_pyramid_pva_sample
58 - @ref imagefilter_pyramid_group
59 - @ref Threshold_group
60 - @ref imagefilter_imagefilter_group