ImageDev

RemoveSmallSpots

Removes the smallest objects of a binary image.

Access to parameter description

This algorithm removes spots smaller than a user-defined size in a binary image.
The objectSize parameter indicates the maximum size, in pixels, of the spots to be removed.

In order to remove the small spots, this algorithm amounts to filtering the image with: See also

Function Syntax

This function returns outputObjectImage.
// Function prototype
std::shared_ptr< iolink::ImageView > removeSmallSpots( std::shared_ptr< iolink::ImageView > inputObjectImage, double objectSize, std::shared_ptr< iolink::ImageView > outputObjectImage = NULL );
This function returns outputObjectImage.
// Function prototype.
remove_small_spots( input_object_image, object_size = 10, output_object_image = None )
This function returns outputObjectImage.
// Function prototype.
public static IOLink.ImageView
RemoveSmallSpots( IOLink.ImageView inputObjectImage,
                  double objectSize = 10,
                  IOLink.ImageView outputObjectImage = null );

Class Syntax

Parameters

Parameter Name Description Type Supported Values Default Value
input
inputObjectImage
The input binary or label image. Image Binary or Label nullptr
input
objectSize
The maximum size, in pixels, of objects to remove. Float64 >0 10
output
outputObjectImage
The output binary or label 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
input_object_image
The input binary or label image. image Binary or Label None
input
object_size
The maximum size, in pixels, of objects to remove. float64 >0 10
output
output_object_image
The output binary or label image. Its dimensions and type are forced to the same values as the input. image None
Parameter Name Description Type Supported Values Default Value
input
inputObjectImage
The input binary or label image. Image Binary or Label null
input
objectSize
The maximum size, in pixels, of objects to remove. Float64 >0 10
output
outputObjectImage
The output binary or label image. Its dimensions and type are forced to the same values as the input. Image null

Object Examples

auto foam_sep = readVipImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "foam_sep.vip" );

RemoveSmallSpots removeSmallSpotsAlgo;
removeSmallSpotsAlgo.setInputObjectImage( foam_sep );
removeSmallSpotsAlgo.setObjectSize( 10.0 );
removeSmallSpotsAlgo.execute();

std::cout << "outputObjectImage:" << removeSmallSpotsAlgo.outputObjectImage()->toString();
foam_sep = imagedev.read_vip_image(imagedev_data.get_image_path("foam_sep.vip"))

remove_small_spots_algo = imagedev.RemoveSmallSpots()
remove_small_spots_algo.input_object_image = foam_sep
remove_small_spots_algo.object_size = 10.0
remove_small_spots_algo.execute()

print( "output_object_image:", str( remove_small_spots_algo.output_object_image ) )
ImageView foam_sep = Data.ReadVipImage( @"Data/images/foam_sep.vip" );

RemoveSmallSpots removeSmallSpotsAlgo = new RemoveSmallSpots
{
    inputObjectImage = foam_sep,
    objectSize = 10.0
};
removeSmallSpotsAlgo.Execute();

Console.WriteLine( "outputObjectImage:" + removeSmallSpotsAlgo.outputObjectImage.ToString() );

Function Examples

auto foam_sep = readVipImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "foam_sep.vip" );

auto result = removeSmallSpots( 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_spots( foam_sep, 10.0 )

print( "output_object_image:", str( result ) )
ImageView foam_sep = Data.ReadVipImage( @"Data/images/foam_sep.vip" );

IOLink.ImageView result = Processing.RemoveSmallSpots( foam_sep, 10.0 );

Console.WriteLine( "outputObjectImage:" + result.ToString() );