This algorithm removes holes smaller than a user-defined size in a binary image.
The holeSize parameter indicates the maximum size, in pixels, of the holes to be filled.
In order to fill the small holes, this algorithm amounts to filtering the complement of the input
image with:
// Function prototype.publicstaticIOLink.ImageViewRemoveSmallHoles(IOLink.ImageView inputObjectImage,double holeSize =10,IOLink.ImageView outputObjectImage =null);
Class Syntax
// Command constructor.RemoveSmallHoles();/// Gets the inputObjectImage parameter./// The input binary image.
std::shared_ptr< iolink::ImageView> inputObjectImage()const;/// Sets the inputObjectImage parameter./// The input binary image.void setInputObjectImage( std::shared_ptr< iolink::ImageView> inputObjectImage );/// Gets the holeSize parameter./// The maximum size in pixels of holes to fill.double holeSize()const;/// Sets the holeSize parameter./// The maximum size in pixels of holes to fill.void setHoleSize(constdouble& holeSize );/// Gets the outputObjectImage parameter./// The output binary image. Its dimensions are forced to the same values as the input.
std::shared_ptr< iolink::ImageView> outputObjectImage()const;/// Sets the outputObjectImage parameter./// The output binary image. Its dimensions are forced to the same values as the input.void setOutputObjectImage( std::shared_ptr< iolink::ImageView> outputObjectImage );// Method to launch the command.void execute();
# Property of the inputObjectImage parameter.RemoveSmallHoles.input_object_image
# Property of the holeSize parameter.RemoveSmallHoles.hole_size
# Property of the outputObjectImage parameter.RemoveSmallHoles.output_object_image
// Method to launch the command.
execute()
// Command constructor.RemoveSmallHoles()// Property of the inputObjectImage parameter.RemoveSmallHoles.inputObjectImage
// Property of the holeSize parameter.RemoveSmallHoles.holeSize
// Property of the outputObjectImage parameter.RemoveSmallHoles.outputObjectImage
// Method to launch the command.Execute()
Parameters
Parameter Name
Description
Type
Supported Values
Default Value
inputObjectImage
The input binary image.
Image
Binary
nullptr
holeSize
The maximum size in pixels of holes to fill.
Float64
>0
10
outputObjectImage
The output binary image. Its dimensions are forced to the same values as the input.
Image
nullptr
Parameter Name
Description
Type
Supported Values
Default Value
input_object_image
The input binary image.
image
Binary
None
hole_size
The maximum size in pixels of holes to fill.
float64
>0
10
output_object_image
The output binary image. Its dimensions are forced to the same values as the input.
image
None
Parameter Name
Description
Type
Supported Values
Default Value
inputObjectImage
The input binary image.
Image
Binary
null
holeSize
The maximum size in pixels of holes to fill.
Float64
>0
10
outputObjectImage
The output binary image. Its dimensions are forced to the same values as the input.
auto foam_sep = readVipImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER )+"foam_sep.vip");auto result = removeSmallHoles( foam_sep,10.0);
std::cout <<"outputObjectImage:"<< result->toString();
foam_sep = imagedev.read_vip_image(imagedev_data.get_image_path("foam_sep.vip"))
result = imagedev.remove_small_holes( foam_sep,10.0)print("output_object_image:", str( result ))
ImageView foam_sep =Data.ReadVipImage(@"Data/images/foam_sep.vip");IOLink.ImageView result =Processing.RemoveSmallHoles( foam_sep,10.0);Console.WriteLine("outputObjectImage:"+ result.ToString());