MarkerBasedWatershedBasinsByBlock
Performs a fast determination of the catchment basins in a grayscale image from a predefined set of markers 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 catchment areas through the entire image.
Notices:
See also
Access to parameter description
For an introduction:
- section Image Segmentation
- section Introduction To Watershed
It is based on a block-wise implementation of the watershed algorithm, building a graph allowing the propagation of the catchment areas through the entire image.
Notices:
- This algorithm requires less free memory than the MarkerBasedWatershed 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.
See also
Function Syntax
This function returns the outputLabelImage output parameter.
// Function prototype. std::shared_ptr< iolink::ImageView > markerBasedWatershedBasinsByBlock( std::shared_ptr< iolink::ImageView > inputGrayImage, std::shared_ptr< iolink::ImageView > inputMarkerImage, MarkerBasedWatershedBasinsByBlock::AlgorithmMode algorithmMode, int32_t blockSize, std::shared_ptr< iolink::ImageView > outputLabelImage = NULL );
This function returns the outputLabelImage output parameter.
// Function prototype. marker_based_watershed_basins_by_block( input_gray_image, input_marker_image, algorithm_mode = MarkerBasedWatershedBasinsByBlock.AlgorithmMode.REPEATABLE, block_size = 256, output_label_image = None )
This function returns the outputLabelImage output parameter.
// Function prototype. public static IOLink.ImageView MarkerBasedWatershedBasinsByBlock( IOLink.ImageView inputGrayImage, IOLink.ImageView inputMarkerImage, MarkerBasedWatershedBasinsByBlock.AlgorithmMode algorithmMode = ImageDev.MarkerBasedWatershedBasinsByBlock.AlgorithmMode.REPEATABLE, Int32 blockSize = 256, IOLink.ImageView outputLabelImage = null );
Class Syntax
Parameters
Class Name | MarkerBasedWatershedBasinsByBlock |
---|
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 | ||||||
blockSize |
The size of blocks used to crop the input images. | Int32 | >=32 | 256 | |||||
outputLabelImage |
The output label image of basins. Its dimensions are forced to the same values as the input image. | Image | nullptr |
Object Examples
auto foam = readVipImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "foam.vip" ); auto foam_sep_label = readVipImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "foam_sep_label.vip" ); MarkerBasedWatershedBasinsByBlock markerBasedWatershedBasinsByBlockAlgo; markerBasedWatershedBasinsByBlockAlgo.setInputGrayImage( foam ); markerBasedWatershedBasinsByBlockAlgo.setInputMarkerImage( foam_sep_label ); markerBasedWatershedBasinsByBlockAlgo.setAlgorithmMode( MarkerBasedWatershedBasinsByBlock::AlgorithmMode::REPEATABLE ); markerBasedWatershedBasinsByBlockAlgo.setBlockSize( 256 ); markerBasedWatershedBasinsByBlockAlgo.execute(); std::cout << "outputLabelImage:" << markerBasedWatershedBasinsByBlockAlgo.outputLabelImage()->toString();
foam = imagedev.read_vip_image(imagedev_data.get_image_path("foam.vip")) foam_sep_label = imagedev.read_vip_image(imagedev_data.get_image_path("foam_sep_label.vip")) marker_based_watershed_basins_by_block_algo = imagedev.MarkerBasedWatershedBasinsByBlock() marker_based_watershed_basins_by_block_algo.input_gray_image = foam marker_based_watershed_basins_by_block_algo.input_marker_image = foam_sep_label marker_based_watershed_basins_by_block_algo.algorithm_mode = imagedev.MarkerBasedWatershedBasinsByBlock.REPEATABLE marker_based_watershed_basins_by_block_algo.block_size = 256 marker_based_watershed_basins_by_block_algo.execute() print( "output_label_image:", str( marker_based_watershed_basins_by_block_algo.output_label_image ) );
ImageView foam = Data.ReadVipImage( @"Data/images/foam.vip" ); ImageView foam_sep_label = Data.ReadVipImage( @"Data/images/foam_sep_label.vip" ); MarkerBasedWatershedBasinsByBlock markerBasedWatershedBasinsByBlockAlgo = new MarkerBasedWatershedBasinsByBlock { inputGrayImage = foam, inputMarkerImage = foam_sep_label, algorithmMode = MarkerBasedWatershedBasinsByBlock.AlgorithmMode.REPEATABLE, blockSize = 256 }; markerBasedWatershedBasinsByBlockAlgo.Execute(); Console.WriteLine( "outputLabelImage:" + markerBasedWatershedBasinsByBlockAlgo.outputLabelImage.ToString() );
Function Examples
auto foam = readVipImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "foam.vip" ); auto foam_sep_label = readVipImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "foam_sep_label.vip" ); auto result = markerBasedWatershedBasinsByBlock( foam, foam_sep_label, MarkerBasedWatershedBasinsByBlock::AlgorithmMode::REPEATABLE, 256 ); std::cout << "outputLabelImage:" << result->toString();
foam = imagedev.read_vip_image(imagedev_data.get_image_path("foam.vip")) foam_sep_label = imagedev.read_vip_image(imagedev_data.get_image_path("foam_sep_label.vip")) result = imagedev.marker_based_watershed_basins_by_block( foam, foam_sep_label, imagedev.MarkerBasedWatershedBasinsByBlock.REPEATABLE, 256 ) print( "output_label_image:", str( result ) );
ImageView foam = Data.ReadVipImage( @"Data/images/foam.vip" ); ImageView foam_sep_label = Data.ReadVipImage( @"Data/images/foam_sep_label.vip" ); IOLink.ImageView result = Processing.MarkerBasedWatershedBasinsByBlock( foam, foam_sep_label, MarkerBasedWatershedBasinsByBlock.AlgorithmMode.REPEATABLE, 256 ); Console.WriteLine( "outputLabelImage:" + result.ToString() );