HExtremaWatershed
Computes the watershed lines of a grayscale image.
Access to parameter description
For an introduction:
A contrast level parameter is used to reduce the number of markers for the watershed process and thus of false positive separation lines.
This algorithm is a high-level combination of numerical reconstruction and watershed algorithms.
There is a limitation to the separation ability: if some particles overlap too much, they are not separated by the algorithm. A sensible criteria is that the distance between particle centroids should be larger than their greatest radius.
This algorithm can be used on the gradient modulus to compute best-fit contours.
Note: This algorithm requires up to 8 times the size of the input image as free memory. If the system does not have enough free memory, this algorithm will fail during its computation. In this case, the HExtremaWatershedByBlock should be used instead.
See also
Access to parameter description
For an introduction:
- section Introduction To Watershed
- section Geodesic Transformations
A contrast level parameter is used to reduce the number of markers for the watershed process and thus of false positive separation lines.
This algorithm is a high-level combination of numerical reconstruction and watershed algorithms.
There is a limitation to the separation ability: if some particles overlap too much, they are not separated by the algorithm. A sensible criteria is that the distance between particle centroids should be larger than their greatest radius.
This algorithm can be used on the gradient modulus to compute best-fit contours.
Note: This algorithm requires up to 8 times the size of the input image as free memory. If the system does not have enough free memory, this algorithm will fail during its computation. In this case, the HExtremaWatershedByBlock should be used instead.
See also
Function Syntax
This function returns the outputImage output parameter.
// Function prototype. std::shared_ptr< iolink::ImageView > hExtremaWatershed( std::shared_ptr< iolink::ImageView > inputGrayImage, HExtremaWatershed::ObjectLightness objectLightness, int32_t contrastValue, HExtremaWatershed::OutputType outputType, HExtremaWatershed::AlgorithmMode algorithmMode, HExtremaWatershed::Neighborhood neighborhood, std::shared_ptr< iolink::ImageView > outputImage = NULL );
This function returns the outputImage output parameter.
// Function prototype. h_extrema_watershed( input_gray_image, object_lightness = HExtremaWatershed.ObjectLightness.DARK_OBJECTS, contrast_value = 30, output_type = HExtremaWatershed.OutputType.SEPARATED_OBJECTS, algorithm_mode = HExtremaWatershed.AlgorithmMode.REPEATABLE, neighborhood = HExtremaWatershed.Neighborhood.CONNECTIVITY_26, output_image = None )
This function returns the outputImage output parameter.
// Function prototype. public static IOLink.ImageView HExtremaWatershed( IOLink.ImageView inputGrayImage, HExtremaWatershed.ObjectLightness objectLightness = ImageDev.HExtremaWatershed.ObjectLightness.DARK_OBJECTS, Int32 contrastValue = 30, HExtremaWatershed.OutputType outputType = ImageDev.HExtremaWatershed.OutputType.SEPARATED_OBJECTS, HExtremaWatershed.AlgorithmMode algorithmMode = ImageDev.HExtremaWatershed.AlgorithmMode.REPEATABLE, HExtremaWatershed.Neighborhood neighborhood = ImageDev.HExtremaWatershed.Neighborhood.CONNECTIVITY_26, IOLink.ImageView outputImage = null );
Class Syntax
Parameters
Class Name | HExtremaWatershed |
---|
Parameter Name | Description | Type | Supported Values | Default Value | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
inputGrayImage |
The input grayscale image. | Image | Grayscale | nullptr | |||||||||
objectLightness |
The lightness of objects to separate.
|
Enumeration | DARK_OBJECTS | ||||||||||
outputType |
The type of result image.
|
Enumeration | SEPARATED_OBJECTS | ||||||||||
algorithmMode |
The mode for applying the watershed algorithm.
|
Enumeration | REPEATABLE | ||||||||||
contrastValue |
The depth of the valley used to select the markers of the watershed. | Int32 | >=0 | 30 | |||||||||
neighborhood |
The 3D neighborhood configuration. This parameter is ignored with a 2D input image.
|
Enumeration | CONNECTIVITY_26 | ||||||||||
outputImage |
The output grayscale, binary or label image. Its dimensions are forced to the same values as the input image. Its type depends on the outputType parameter. | Image | nullptr |
Object Examples
auto foam = readVipImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "foam.vip" ); HExtremaWatershed hExtremaWatershedAlgo; hExtremaWatershedAlgo.setInputGrayImage( foam ); hExtremaWatershedAlgo.setObjectLightness( HExtremaWatershed::ObjectLightness::DARK_OBJECTS ); hExtremaWatershedAlgo.setContrastValue( 30 ); hExtremaWatershedAlgo.setOutputType( HExtremaWatershed::OutputType::SEPARATED_OBJECTS ); hExtremaWatershedAlgo.setAlgorithmMode( HExtremaWatershed::AlgorithmMode::REPEATABLE ); hExtremaWatershedAlgo.setNeighborhood( HExtremaWatershed::Neighborhood::CONNECTIVITY_26 ); hExtremaWatershedAlgo.execute(); std::cout << "outputImage:" << hExtremaWatershedAlgo.outputImage()->toString();
foam = imagedev.read_vip_image(imagedev_data.get_image_path("foam.vip")) h_extrema_watershed_algo = imagedev.HExtremaWatershed() h_extrema_watershed_algo.input_gray_image = foam h_extrema_watershed_algo.object_lightness = imagedev.HExtremaWatershed.DARK_OBJECTS h_extrema_watershed_algo.contrast_value = 30 h_extrema_watershed_algo.output_type = imagedev.HExtremaWatershed.SEPARATED_OBJECTS h_extrema_watershed_algo.algorithm_mode = imagedev.HExtremaWatershed.REPEATABLE h_extrema_watershed_algo.neighborhood = imagedev.HExtremaWatershed.CONNECTIVITY_26 h_extrema_watershed_algo.execute() print( "output_image:", str( h_extrema_watershed_algo.output_image ) );
ImageView foam = Data.ReadVipImage( @"Data/images/foam.vip" ); HExtremaWatershed hExtremaWatershedAlgo = new HExtremaWatershed { inputGrayImage = foam, objectLightness = HExtremaWatershed.ObjectLightness.DARK_OBJECTS, contrastValue = 30, outputType = HExtremaWatershed.OutputType.SEPARATED_OBJECTS, algorithmMode = HExtremaWatershed.AlgorithmMode.REPEATABLE, neighborhood = HExtremaWatershed.Neighborhood.CONNECTIVITY_26 }; hExtremaWatershedAlgo.Execute(); Console.WriteLine( "outputImage:" + hExtremaWatershedAlgo.outputImage.ToString() );
Function Examples
auto foam = readVipImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "foam.vip" ); auto result = hExtremaWatershed( foam, HExtremaWatershed::ObjectLightness::DARK_OBJECTS, 30, HExtremaWatershed::OutputType::SEPARATED_OBJECTS, HExtremaWatershed::AlgorithmMode::REPEATABLE, HExtremaWatershed::Neighborhood::CONNECTIVITY_26 ); std::cout << "outputImage:" << result->toString();
foam = imagedev.read_vip_image(imagedev_data.get_image_path("foam.vip")) result = imagedev.h_extrema_watershed( foam, imagedev.HExtremaWatershed.DARK_OBJECTS, 30, imagedev.HExtremaWatershed.SEPARATED_OBJECTS, imagedev.HExtremaWatershed.REPEATABLE, imagedev.HExtremaWatershed.CONNECTIVITY_26 ) print( "output_image:", str( result ) );
ImageView foam = Data.ReadVipImage( @"Data/images/foam.vip" ); IOLink.ImageView result = Processing.HExtremaWatershed( foam, HExtremaWatershed.ObjectLightness.DARK_OBJECTS, 30, HExtremaWatershed.OutputType.SEPARATED_OBJECTS, HExtremaWatershed.AlgorithmMode.REPEATABLE, HExtremaWatershed.Neighborhood.CONNECTIVITY_26 ); Console.WriteLine( "outputImage:" + result.ToString() );