BinarySmoothing2d
Transforms a binary two-dimensional image into another binary image with respect to the real local mean of each pixel neighborhood.
Access to parameter description
This algorithm computes a binary smoothing using a specified window size.
It consists of a two step procedure:
Figure 1. Effects of the binary smoothing algorithm: (a) original grayscale image,@Br
(b) binary image after thresholding, (c) result of a binary smoothing using a 9x9 window
See also
Access to parameter description
This algorithm computes a binary smoothing using a specified window size.
It consists of a two step procedure:
- Computation of the local mean in the neighborhood, defined by the window size, considering foreground pixels with a value of 1 and background pixels with a value of 0.
- Thresholding of the result using the threshold parameter.
(a) |
(b) |
(c) |
See also
Function Syntax
This function returns outputBinaryImage.
// Function prototype
std::shared_ptr< iolink::ImageView > binarySmoothing2d( std::shared_ptr< iolink::ImageView > inputBinaryImage, int32_t kernelRadiusX, int32_t kernelRadiusY, double threshold, std::shared_ptr< iolink::ImageView > outputBinaryImage = nullptr );
This function returns outputBinaryImage.
// Function prototype. binary_smoothing_2d(input_binary_image: idt.ImageType, kernel_radius_x: int = 3, kernel_radius_y: int = 3, threshold: float = 0.5, output_binary_image: idt.ImageType = None) -> idt.ImageType
This function returns outputBinaryImage.
// Function prototype. public static IOLink.ImageView BinarySmoothing2d( IOLink.ImageView inputBinaryImage, Int32 kernelRadiusX = 3, Int32 kernelRadiusY = 3, double threshold = 0.5, IOLink.ImageView outputBinaryImage = null );
Class Syntax
Parameters
Parameter Name | Description | Type | Supported Values | Default Value | |
---|---|---|---|---|---|
inputBinaryImage |
The input binary image. | Image | Binary | nullptr | |
kernelRadiusX |
The kernel horizontal half length, in pixels. A value N produces a 2N+1 pixels length. | Int32 | >=1 | 3 | |
kernelRadiusY |
The kernel vertical half length, in pixels. A value N produces a 2N+1 pixels length. | Int32 | >=1 | 3 | |
threshold |
The threshold value applied to the local mean (the minimum volume fraction in the window to set a pixel to 1). | Float64 | ]0, 1] | 0.5 | |
outputBinaryImage |
The output binary image. Its dimensions and type are forced to the same values as the input. | Image | nullptr |
Parameter Name | Description | Type | Supported Values | Default Value | |
---|---|---|---|---|---|
input_binary_image |
The input binary image. | image | Binary | None | |
kernel_radius_x |
The kernel horizontal half length, in pixels. A value N produces a 2N+1 pixels length. | int32 | >=1 | 3 | |
kernel_radius_y |
The kernel vertical half length, in pixels. A value N produces a 2N+1 pixels length. | int32 | >=1 | 3 | |
threshold |
The threshold value applied to the local mean (the minimum volume fraction in the window to set a pixel to 1). | float64 | ]0, 1] | 0.5 | |
output_binary_image |
The output binary image. Its dimensions and type are forced to the same values as the input. | image | None |
Parameter Name | Description | Type | Supported Values | Default Value | |
---|---|---|---|---|---|
inputBinaryImage |
The input binary image. | Image | Binary | null | |
kernelRadiusX |
The kernel horizontal half length, in pixels. A value N produces a 2N+1 pixels length. | Int32 | >=1 | 3 | |
kernelRadiusY |
The kernel vertical half length, in pixels. A value N produces a 2N+1 pixels length. | Int32 | >=1 | 3 | |
threshold |
The threshold value applied to the local mean (the minimum volume fraction in the window to set a pixel to 1). | Float64 | ]0, 1] | 0.5 | |
outputBinaryImage |
The output binary image. Its dimensions and type are forced to the same values as the input. | Image | null |
Object Examples
auto polystyrene_sep = readVipImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "polystyrene_sep.vip" ); BinarySmoothing2d binarySmoothing2dAlgo; binarySmoothing2dAlgo.setInputBinaryImage( polystyrene_sep ); binarySmoothing2dAlgo.setKernelRadiusX( 3 ); binarySmoothing2dAlgo.setKernelRadiusY( 3 ); binarySmoothing2dAlgo.setThreshold( 0.5 ); binarySmoothing2dAlgo.execute(); std::cout << "outputBinaryImage:" << binarySmoothing2dAlgo.outputBinaryImage()->toString();
polystyrene_sep = imagedev.read_vip_image(imagedev_data.get_image_path("polystyrene_sep.vip")) binary_smoothing_2d_algo = imagedev.BinarySmoothing2d() binary_smoothing_2d_algo.input_binary_image = polystyrene_sep binary_smoothing_2d_algo.kernel_radius_x = 3 binary_smoothing_2d_algo.kernel_radius_y = 3 binary_smoothing_2d_algo.threshold = 0.5 binary_smoothing_2d_algo.execute() print("output_binary_image:", str(binary_smoothing_2d_algo.output_binary_image))
ImageView polystyrene_sep = Data.ReadVipImage( @"Data/images/polystyrene_sep.vip" ); BinarySmoothing2d binarySmoothing2dAlgo = new BinarySmoothing2d { inputBinaryImage = polystyrene_sep, kernelRadiusX = 3, kernelRadiusY = 3, threshold = 0.5 }; binarySmoothing2dAlgo.Execute(); Console.WriteLine( "outputBinaryImage:" + binarySmoothing2dAlgo.outputBinaryImage.ToString() );
Function Examples
auto polystyrene_sep = readVipImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "polystyrene_sep.vip" ); auto result = binarySmoothing2d( polystyrene_sep, 3, 3, 0.5 ); std::cout << "outputBinaryImage:" << result->toString();
polystyrene_sep = imagedev.read_vip_image(imagedev_data.get_image_path("polystyrene_sep.vip")) result = imagedev.binary_smoothing_2d(polystyrene_sep, 3, 3, 0.5) print("output_binary_image:", str(result))
ImageView polystyrene_sep = Data.ReadVipImage( @"Data/images/polystyrene_sep.vip" ); IOLink.ImageView result = Processing.BinarySmoothing2d( polystyrene_sep, 3, 3, 0.5 ); Console.WriteLine( "outputBinaryImage:" + result.ToString() );