Back to Adaptive Vision Library Lite websiteYou are here:
Start »
Image Local Transforms »
SmoothImage_Mean
Header: | AVL.h |
Namespace: | avl |
Smooths an image by averaging pixels within a rectangular kernel.
Syntax
void avl::SmoothImage_Mean
(
const avl::Image& inImage,
atl::Optional<const avl::Region&> inRoi,
atl::Optional<const avl::Region&> inSourceRoi,
atl::Optional<avl::Pixel> inBorderColor,
avl::KernelShape::Type inKernel,
int inRadiusX,
atl::Optional<int> inRadiusY,
avl::Image& outImage
)
Parameters
|
Name |
Type |
Range |
Default |
Description |
![](../../img/in.png) |
inImage |
const Image& |
|
|
Input image |
![](../../img/in.png) |
inRoi |
Optional<const Region&> |
|
NIL |
Range of outImage pixels to be computed |
![](../../img/in.png) |
inSourceRoi |
Optional<const Region&> |
|
NIL |
Range of inImage pixels to be read |
![](../../img/in.png) |
inBorderColor |
Optional<Pixel> |
|
NIL |
Color of the imaginary pixels outside the image boundaries |
![](../../img/in.png) |
inKernel |
KernelShape::Type |
|
|
Kernel shape |
![](../../img/in.png) |
inRadiusX |
int |
0 - ![](../../img/infinity.png) |
1 |
Nearly half of the kernel's width (2*R+1) |
![](../../img/in.png) |
inRadiusY |
Optional<int> |
0 - ![](../../img/infinity.png) |
NIL |
Nearly half of the kernel's height (2*R+1), or same as inRadiusX |
![](../../img/out.png) |
outImage |
Image& |
|
|
Output image |
Description
Replaces each pixel with the average of all pixels contained in a rectangular kernel.
The width of the kernel is 2 * inRadiusX + 1, the height is 2 * inRadiusY + 1.
When inRadiusY is set to Auto, then its value is implicitly copied from inRadiusX.
Hints
- Define the size of the kernel by setting inRadiusX and - optionally - inRadiusY.
- Highest performance will be achieved with inKernel = Box. Other kernel shapes will result is longer execution time.
- Define inSourceRoi is some pixels of the input images should be ignored (advanced).
Examples
SmoothImage_Mean performed on a sample image with inRadiusX = 4.
Hardware Acceleration
This operation supports automatic parallelization for multicore and multiprocessor systems.
Errors
List of possible exceptions:
Error type |
Description |
DomainError |
inBorderColor is relevant only when inSourceRoi is set to Auto (NIL) in SmoothImage_Mean. |
DomainError |
Not supported kernel on input in SmoothImage_Mean. |