BoxFilter3d
Smoothes an image using a box kernel.
Access to parameter description
For an introduction to image filters: section Images Filtering.
This algorithm smoothes an image using the same box kernel as a lowpass filter. The filter's X, Y, and Z sizes are user-defined.
The algorithm calculates the local mean in a given size window. For a window of size $2p+1$ in X, $2q+1$ in Y and $2r+1$ in Z: $$ O(n,m,o)=\frac{1}{K}\sum_{i=-p}^{p}\sum_{j=-q}^{q}\sum_{k=-r}^{r} I(n-i,m-j,o-k) $$ The K coefficient is the normalization factor:
See also
Access to parameter description
For an introduction to image filters: section Images Filtering.
This algorithm smoothes an image using the same box kernel as a lowpass filter. The filter's X, Y, and Z sizes are user-defined.
The algorithm calculates the local mean in a given size window. For a window of size $2p+1$ in X, $2q+1$ in Y and $2r+1$ in Z: $$ O(n,m,o)=\frac{1}{K}\sum_{i=-p}^{p}\sum_{j=-q}^{q}\sum_{k=-r}^{r} I(n-i,m-j,o-k) $$ The K coefficient is the normalization factor:
- $K = 1$ if the result is not normalized;
- $K = (2p+1) (2q+1) (2r+1)$ otherwise.
See also
Function Syntax
This function returns the outputImage output parameter.
// Function prototype. std::shared_ptr< iolink::ImageView > boxFilter3d( std::shared_ptr< iolink::ImageView > inputImage, int32_t kernelSizeX, int32_t kernelSizeY, int32_t kernelSizeZ, BoxFilter3d::AutoScale autoScale, std::shared_ptr< iolink::ImageView > outputImage = NULL );
This function returns the outputImage output parameter.
// Function prototype. box_filter_3d( input_image, kernel_size_x = 3, kernel_size_y = 3, kernel_size_z = 3, auto_scale = BoxFilter3d.AutoScale.YES, output_image = None )
This function returns the outputImage output parameter.
// Function prototype. public static IOLink.ImageView BoxFilter3d( IOLink.ImageView inputImage, Int32 kernelSizeX = 3, Int32 kernelSizeY = 3, Int32 kernelSizeZ = 3, BoxFilter3d.AutoScale autoScale = ImageDev.BoxFilter3d.AutoScale.YES, IOLink.ImageView outputImage = null );
Class Syntax
Parameters
Class Name | BoxFilter3d |
---|
Parameter Name | Description | Type | Supported Values | Default Value | |||||
---|---|---|---|---|---|---|---|---|---|
kernelSizeX |
The horizontal kernel size. | Int32 | >=1 | 3 | |||||
kernelSizeY |
The vertical kernel size. | Int32 | >=1 | 3 | |||||
kernelSizeZ |
The depth kernel size. | Int32 | >=1 | 3 | |||||
inputImage |
The input image. | Image | Binary, Grayscale or Multispectral | nullptr | |||||
autoScale |
The automatic intensity scaling mode.
|
Enumeration | YES | ||||||
outputImage |
The output image. Its dimensions are forced to the same values as the input. Its type is the same as the input if the normalization is set to yes, else the type is upgraded. | Image | nullptr |
Object Examples
auto foam = readVipImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "foam.vip" ); BoxFilter3d boxFilter3dAlgo; boxFilter3dAlgo.setInputImage( foam ); boxFilter3dAlgo.setKernelSizeX( 3 ); boxFilter3dAlgo.setKernelSizeY( 3 ); boxFilter3dAlgo.setKernelSizeZ( 3 ); boxFilter3dAlgo.setAutoScale( BoxFilter3d::AutoScale::YES ); boxFilter3dAlgo.execute(); std::cout << "outputImage:" << boxFilter3dAlgo.outputImage()->toString();
foam = imagedev.read_vip_image(imagedev_data.get_image_path("foam.vip")) box_filter_3d_algo = imagedev.BoxFilter3d() box_filter_3d_algo.input_image = foam box_filter_3d_algo.kernel_size_x = 3 box_filter_3d_algo.kernel_size_y = 3 box_filter_3d_algo.kernel_size_z = 3 box_filter_3d_algo.auto_scale = imagedev.BoxFilter3d.YES box_filter_3d_algo.execute() print( "output_image:", str( box_filter_3d_algo.output_image ) );
ImageView foam = Data.ReadVipImage( @"Data/images/foam.vip" ); BoxFilter3d boxFilter3dAlgo = new BoxFilter3d { inputImage = foam, kernelSizeX = 3, kernelSizeY = 3, kernelSizeZ = 3, autoScale = BoxFilter3d.AutoScale.YES }; boxFilter3dAlgo.Execute(); Console.WriteLine( "outputImage:" + boxFilter3dAlgo.outputImage.ToString() );
Function Examples
auto foam = readVipImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "foam.vip" ); auto result = boxFilter3d( foam, 3, 3, 3, BoxFilter3d::AutoScale::YES ); std::cout << "outputImage:" << result->toString();
foam = imagedev.read_vip_image(imagedev_data.get_image_path("foam.vip")) result = imagedev.box_filter_3d( foam, 3, 3, 3, imagedev.BoxFilter3d.YES ) print( "output_image:", str( result ) );
ImageView foam = Data.ReadVipImage( @"Data/images/foam.vip" ); IOLink.ImageView result = Processing.BoxFilter3d( foam, 3, 3, 3, BoxFilter3d.AutoScale.YES ); Console.WriteLine( "outputImage:" + result.ToString() );