Back to Adaptive Vision Library website

Header: AVL.h avl FoundationLite

Smooths an image using a predefined gaussian kernel.

Applications: Removal of gaussian noise from images (fast).

### Syntax

C++
C#

void avl::SmoothImage_Gauss_Mask
(
const avl::Image& inImage,
atl::Optional<const avl::Region&> inRoi,
avl::GaussKernel::Type inKernel,
avl::Image& outImage
)


### Parameters

Name Type Default Description
inImage const Image& Input image
inRoi Optional<const Region&> NIL Range of outImage pixels to be computed
inKernel GaussKernel::Type _3x3 Predefined Gauss kernel
outImage Image& Output image

### Description

This operation is a simplified, fast in computation, version of SmoothImage_Gauss, with predefined kernel and simplified ROI handling.

Kernel used in operation can be chosen by inKernel parameter:

• Box_2x2: 3 by 3 pixels kernel similar to 2 by 2 gaussian kernel rotated by 45 degrees: $$\frac{1}{8}\begin{bmatrix} 0 & 1 & 0 \\ 1 & (4) & 1 \\ 0 & 1 & 0 \\ \end{bmatrix}$$
• Box_3x3: 3 by 3 pixels kernel with StdDev ≈ 0.85 of following form: $$\frac{1}{16}\begin{bmatrix} 1 & 2 & 1 \\ 2 & (4) & 2 \\ 1 & 2 & 1 \\ \end{bmatrix}$$
• Box_5x5: 5 by 5 pixels kernel with StdDev ≈ 1.1 of following form: $$\frac{1}{169}\begin{bmatrix} 1 & 3 & 5 & 3 & 1 \\ 3 & 9 & 15 & 9 & 3 \\ 5 & 15 & (25) & 15 & 5 \\ 3 & 9 & 15 & 9 & 3 \\ 1 & 3 & 5 & 3 & 1 \\ \end{bmatrix}$$
• Box_7x7: 7 by 7 pixels kernel with StdDev ≈ 1.7 of following form: $$\frac{1}{256}\begin{bmatrix} 1 & 2 & 3 & 4 & 3 & 2 & 1 \\ 2 & 4 & 6 & 8 & 6 & 4 & 2 \\ 3 & 6 & 9 & 12 & 9 & 6 & 3 \\ 4 & 8 & 12 & (16) & 12 & 8 & 4 \\ 3 & 6 & 9 & 12 & 9 & 6 & 3 \\ 2 & 4 & 6 & 8 & 6 & 4 & 2 \\ 1 & 2 & 3 & 4 & 3 & 2 & 1 \\ \end{bmatrix}$$
• Box_9x9: 9 by 9 pixels kernel with StdDev ≈ 2.0 of following form: $$\frac{1}{1089}\begin{bmatrix} 1 & 2 & 4 & 6 & 7 & 6 & 4 & 2 & 1 \\ 2 & 4 & 8 & 12 & 14 & 12 & 8 & 4 & 2 \\ 4 & 8 & 16 & 24 & 28 & 24 & 16 & 8 & 4 \\ 6 & 12 & 24 & 36 & 42 & 36 & 24 & 12 & 6 \\ 7 & 14 & 28 & 42 & (49) & 42 & 28 & 14 & 7 \\ 6 & 12 & 24 & 36 & 42 & 36 & 24 & 12 & 6 \\ 4 & 8 & 16 & 24 & 28 & 24 & 16 & 8 & 4 \\ 2 & 4 & 8 & 12 & 14 & 12 & 8 & 4 & 2 \\ 1 & 2 & 4 & 6 & 7 & 6 & 4 & 2 & 1 \\ \end{bmatrix}$$
• Box_11x11: 11 by 11 pixels kernel with StdDev ≈ 2.2 of following form: $$\frac{1}{4096}\begin{bmatrix} 1 & 2 & 4 & 8 & 11 & 12 & 11 & 8 & 4 & 2 & 1 \\ 2 & 4 & 8 & 16 & 22 & 24 & 22 & 16 & 8 & 4 & 2 \\ 4 & 8 & 16 & 32 & 44 & 48 & 44 & 32 & 16 & 8 & 4 \\ 8 & 16 & 32 & 64 & 88 & 96 & 88 & 64 & 32 & 16 & 8 \\ 11 & 22 & 44 & 88 & 121 & 132 & 121 & 88 & 44 & 22 & 11 \\ 12 & 24 & 48 & 96 & 132 & (144) & 132 & 96 & 48 & 24 & 12 \\ 11 & 22 & 44 & 88 & 121 & 132 & 121 & 88 & 44 & 22 & 11 \\ 8 & 16 & 32 & 64 & 88 & 96 & 88 & 64 & 32 & 16 & 8 \\ 4 & 8 & 16 & 32 & 44 & 48 & 44 & 32 & 16 & 8 & 4 \\ 2 & 4 & 8 & 16 & 22 & 24 & 22 & 16 & 8 & 4 & 2 \\ 1 & 2 & 4 & 8 & 11 & 12 & 11 & 8 & 4 & 2 & 1 \\ \end{bmatrix}$$

### Hints

• Select kernel size by setting the inKernel input.

### Examples

SmoothImage_Gauss_Mask performed on a sample image with inKernel = _11x11.

### Hardware Acceleration

This operation is optimized for SSE2 technology for pixels of types: UINT8, SINT16.

This operation is optimized for SSE4.1 technology for pixels of types: Kernel 11x11 UINT8.

This operation is optimized for AVX2 technology for pixels of type: UINT8.

This operation is optimized for NEON technology for pixels of type: UINT8.

This operation supports automatic parallelization for multicore and multiprocessor systems.

### Errors

List of possible exceptions:

Error type Description
DomainError Region exceeds an input image in SmoothImage_Gauss_Mask.