SnnFilter2d
Performs an edge-preserving smoothing of a two-dimensional image with the Symmetric Nearest Neighbor filter.
Access to parameter description
For an introduction to image filters: see Images Filtering.
This algorithm implements the Symmetric Nearest Neighbor filter (SNN), which is an average filter weighted by the structural symmetry of a rectangular neighborhood window. It computes a local mean around a central pixel x, considering for each neighbor pixel y, having a gray level I(y), the value given by:
I′(y)={I(y) if |I(x)−I(y)|<|I(x)−I(ys)|I(ys) if |I(x)−I(y)|>|I(x)−I(ys)|I(x) otherwise Where ys is the neighbor pixel symmetric to y with respect to x.
The output value of the pixel x is then given by: O(x)=μ[I′(y)] Where μ is the mean value of the local window.
See also
Access to parameter description
For an introduction to image filters: see Images Filtering.
This algorithm implements the Symmetric Nearest Neighbor filter (SNN), which is an average filter weighted by the structural symmetry of a rectangular neighborhood window. It computes a local mean around a central pixel x, considering for each neighbor pixel y, having a gray level I(y), the value given by:
I′(y)={I(y) if |I(x)−I(y)|<|I(x)−I(ys)|I(ys) if |I(x)−I(y)|>|I(x)−I(ys)|I(x) otherwise Where ys is the neighbor pixel symmetric to y with respect to x.
The output value of the pixel x is then given by: O(x)=μ[I′(y)] Where μ is the mean value of the local window.
See also
Function Syntax
This function returns outputImage.
// Function prototype
std::shared_ptr< iolink::ImageView > snnFilter2d( std::shared_ptr< iolink::ImageView > inputImage, int32_t kernelSizeX, int32_t kernelSizeY, std::shared_ptr< iolink::ImageView > outputImage = NULL );
Class Syntax
Parameters
Parameter Name | Description | Type | Supported Values | Default Value | |
---|---|---|---|---|---|
![]() |
inputImage |
The input image. | Image | Binary, Label, Grayscale or Multispectral | nullptr |
![]() |
kernelSizeX |
The horizontal kernel size in pixels (odd value). | Int32 | [3, 100] | 3 |
![]() |
kernelSizeY |
The vertical kernel size in pixels (odd value). | Int32 | [3, 100] | 3 |
![]() |
outputImage |
The output image. Its dimensions, type and calibration are forced to the same values as the input. | Image | nullptr |
Object Examples
std::shared_ptr< iolink::ImageView > polystyrene = ioformat::readImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "polystyrene.tif" ); SnnFilter2d snnFilter2dAlgo; snnFilter2dAlgo.setInputImage( polystyrene ); snnFilter2dAlgo.setKernelSizeX( 3 ); snnFilter2dAlgo.setKernelSizeY( 3 ); snnFilter2dAlgo.execute(); std::cout << "outputImage:" << snnFilter2dAlgo.outputImage()->toString();
Function Examples
std::shared_ptr< iolink::ImageView > polystyrene = ioformat::readImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "polystyrene.tif" ); auto result = snnFilter2d( polystyrene, 3, 3 ); std::cout << "outputImage:" << result->toString();