HExtremaWatershedByBlock
Computes the watershed lines of a grayscale image in a low memory consumption mode.
Access to parameter description
For an introduction:
It is based on a block-wise implementation of the watershed algorithm, building a graph allowing the propagation of the catchments areas through the entire image.
Note:
Access to parameter description
For an introduction:
- section Introduction To Watershed
- section Geodesic Transformations
It is based on a block-wise implementation of the watershed algorithm, building a graph allowing the propagation of the catchments areas through the entire image.
Note:
- This algorithm requires less free memory than the HExtremaWatershed algorithm but is much slower to execute.
- As the implementation is totally different, the results of both algorithms may differ slightly, especially on areas where the input landscape image contains some plateaus.
Function Syntax
This function returns the outputImage output parameter.
// Function prototype. std::shared_ptr< iolink::ImageView > hExtremaWatershedByBlock( std::shared_ptr< iolink::ImageView > inputGrayImage, HExtremaWatershedByBlock::ObjectLightness objectLightness, int32_t contrastValue, HExtremaWatershedByBlock::OutputType outputType, HExtremaWatershedByBlock::AlgorithmMode algorithmMode, int32_t blockSize, HExtremaWatershedByBlock::Neighborhood neighborhood, std::shared_ptr< iolink::ImageView > outputImage = NULL );
Class Syntax
Parameters
Class Name | HExtremaWatershedByBlock |
---|
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 | |||||||||
![]() |
contrastValue |
The depth of the valley used to select the markers of the watershed. | Int32 | >=0 | 30 | ||||||||
![]() |
outputType |
The type of result image.
|
Enumeration | SEPARATED_OBJECTS | |||||||||
![]() |
algorithmMode |
The mode for applying the watershed algorithm.
|
Enumeration | REPEATABLE | |||||||||
![]() |
blockSize |
The size of blocks used to crop the input images. | Int32 | >=32 | 256 | ||||||||
![]() |
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" ); HExtremaWatershedByBlock hExtremaWatershedByBlockAlgo; hExtremaWatershedByBlockAlgo.setInputGrayImage( foam ); hExtremaWatershedByBlockAlgo.setObjectLightness( HExtremaWatershedByBlock::ObjectLightness::DARK_OBJECTS ); hExtremaWatershedByBlockAlgo.setContrastValue( 30 ); hExtremaWatershedByBlockAlgo.setOutputType( HExtremaWatershedByBlock::OutputType::SEPARATED_OBJECTS ); hExtremaWatershedByBlockAlgo.setAlgorithmMode( HExtremaWatershedByBlock::AlgorithmMode::REPEATABLE ); hExtremaWatershedByBlockAlgo.setBlockSize( 256 ); hExtremaWatershedByBlockAlgo.setNeighborhood( HExtremaWatershedByBlock::Neighborhood::CONNECTIVITY_26 ); hExtremaWatershedByBlockAlgo.execute(); std::cout << "outputImage:" << hExtremaWatershedByBlockAlgo.outputImage()->toString();
Function Examples
auto foam = readVipImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "foam.vip" ); auto result = hExtremaWatershedByBlock( foam, HExtremaWatershedByBlock::ObjectLightness::DARK_OBJECTS, 30, HExtremaWatershedByBlock::OutputType::SEPARATED_OBJECTS, HExtremaWatershedByBlock::AlgorithmMode::REPEATABLE, 256, HExtremaWatershedByBlock::Neighborhood::CONNECTIVITY_26 ); std::cout << "outputImage:" << result->toString();