MarkerBasedWatershed2d
Performs a fast determination of the watershed lines in a two-dimensional grayscale image from a predefined set of markers.
Access to parameter description
For an introduction:
It determines the crest lines separating the markers.
Three ways of presenting the resulting image are provided:
See also
Access to parameter description
For an introduction:
- section Image Segmentation
- section Introduction To Watershed
It determines the crest lines separating the markers.
Three ways of presenting the resulting image are provided:
- Crest lines are output in a binary image.
- Marked basins are output in a label image with crest lines considered as background.
- Marked basins are output in a label image with crest lines filled by a marker value.
See also
Function Syntax
This function returns outputImage.
// Function prototype
std::shared_ptr< iolink::ImageView > markerBasedWatershed2d( std::shared_ptr< iolink::ImageView > inputGrayImage, std::shared_ptr< iolink::ImageView > inputMarkerImage, MarkerBasedWatershed2d::AlgorithmMode algorithmMode, MarkerBasedWatershed2d::OutputType outputType, MarkerBasedWatershed2d::Neighborhood neighborhood, std::shared_ptr< iolink::ImageView > outputImage = NULL );
Class Syntax
Parameters
Parameter Name | Description | Type | Supported Values | Default Value | |||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() |
inputGrayImage |
The input grayscale image representing the landscape of the watershed. | Image | Grayscale | nullptr | ||||||
![]() |
inputMarkerImage |
The input label image of markers. | Image | Label | nullptr | ||||||
![]() |
algorithmMode |
The mode for applying the watershed algorithm.
|
Enumeration | REPEATABLE | |||||||
![]() |
outputType |
The type of output image.
|
Enumeration | SEPARATED_REGIONS | |||||||
![]() |
neighborhood |
The type of neighborhood used for the propagation.
|
Enumeration | CONNECTIVITY_4 | |||||||
![]() |
outputImage |
The output binary image. Its dimensions are forced to the same values as the input image. Its type depends on the selected outputType and potentially on the highest label of the inputMarkerImage. | Image | nullptr |
Object Examples
std::shared_ptr< iolink::ImageView > polystyrene = ioformat::readImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "polystyrene.tif" ); auto polystyrene_sep_label = readVipImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "polystyrene_sep_label.vip" ); MarkerBasedWatershed2d markerBasedWatershed2dAlgo; markerBasedWatershed2dAlgo.setInputGrayImage( polystyrene ); markerBasedWatershed2dAlgo.setInputMarkerImage( polystyrene_sep_label ); markerBasedWatershed2dAlgo.setAlgorithmMode( MarkerBasedWatershed2d::AlgorithmMode::REPEATABLE ); markerBasedWatershed2dAlgo.setOutputType( MarkerBasedWatershed2d::OutputType::LINES ); markerBasedWatershed2dAlgo.setNeighborhood( MarkerBasedWatershed2d::Neighborhood::CONNECTIVITY_4 ); markerBasedWatershed2dAlgo.execute(); std::cout << "outputImage:" << markerBasedWatershed2dAlgo.outputImage()->toString();
Function Examples
std::shared_ptr< iolink::ImageView > polystyrene = ioformat::readImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "polystyrene.tif" ); auto polystyrene_sep_label = readVipImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "polystyrene_sep_label.vip" ); auto result = markerBasedWatershed2d( polystyrene, polystyrene_sep_label, MarkerBasedWatershed2d::AlgorithmMode::REPEATABLE, MarkerBasedWatershed2d::OutputType::LINES, MarkerBasedWatershed2d::Neighborhood::CONNECTIVITY_4 ); std::cout << "outputImage:" << result->toString();