MarkerBasedWatershedByBlock
Performs a fast determination of the watershed lines 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.
Note:
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.
Note:
- 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 outputBinaryImage.
// Function prototype
std::shared_ptr< iolink::ImageView > markerBasedWatershedByBlock( std::shared_ptr< iolink::ImageView > inputGrayImage, std::shared_ptr< iolink::ImageView > inputMarkerImage, MarkerBasedWatershedByBlock::AlgorithmMode algorithmMode, int32_t blockSize, std::shared_ptr< iolink::ImageView > outputBinaryImage = NULL );
This function returns outputBinaryImage.
// Function prototype. marker_based_watershed_by_block( input_gray_image, input_marker_image, algorithm_mode = MarkerBasedWatershedByBlock.AlgorithmMode.REPEATABLE, block_size = 256, output_binary_image = None )
This function returns outputBinaryImage.
// Function prototype. public static IOLink.ImageView MarkerBasedWatershedByBlock( IOLink.ImageView inputGrayImage, IOLink.ImageView inputMarkerImage, MarkerBasedWatershedByBlock.AlgorithmMode algorithmMode = ImageDev.MarkerBasedWatershedByBlock.AlgorithmMode.REPEATABLE, Int32 blockSize = 256, IOLink.ImageView outputBinaryImage = null );
Class Syntax
Parameters
Class Name | MarkerBasedWatershedByBlock |
---|
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 | |||||
outputBinaryImage |
The output binary image. 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" ); MarkerBasedWatershedByBlock markerBasedWatershedByBlockAlgo; markerBasedWatershedByBlockAlgo.setInputGrayImage( foam ); markerBasedWatershedByBlockAlgo.setInputMarkerImage( foam_sep_label ); markerBasedWatershedByBlockAlgo.setAlgorithmMode( MarkerBasedWatershedByBlock::AlgorithmMode::REPEATABLE ); markerBasedWatershedByBlockAlgo.setBlockSize( 256 ); markerBasedWatershedByBlockAlgo.execute(); std::cout << "outputBinaryImage:" << markerBasedWatershedByBlockAlgo.outputBinaryImage()->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_by_block_algo = imagedev.MarkerBasedWatershedByBlock() marker_based_watershed_by_block_algo.input_gray_image = foam marker_based_watershed_by_block_algo.input_marker_image = foam_sep_label marker_based_watershed_by_block_algo.algorithm_mode = imagedev.MarkerBasedWatershedByBlock.REPEATABLE marker_based_watershed_by_block_algo.block_size = 256 marker_based_watershed_by_block_algo.execute() print( "output_binary_image:", str( marker_based_watershed_by_block_algo.output_binary_image ) )
ImageView foam = Data.ReadVipImage( @"Data/images/foam.vip" ); ImageView foam_sep_label = Data.ReadVipImage( @"Data/images/foam_sep_label.vip" ); MarkerBasedWatershedByBlock markerBasedWatershedByBlockAlgo = new MarkerBasedWatershedByBlock { inputGrayImage = foam, inputMarkerImage = foam_sep_label, algorithmMode = MarkerBasedWatershedByBlock.AlgorithmMode.REPEATABLE, blockSize = 256 }; markerBasedWatershedByBlockAlgo.Execute(); Console.WriteLine( "outputBinaryImage:" + markerBasedWatershedByBlockAlgo.outputBinaryImage.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 = markerBasedWatershedByBlock( foam, foam_sep_label, MarkerBasedWatershedByBlock::AlgorithmMode::REPEATABLE, 256 ); std::cout << "outputBinaryImage:" << 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_by_block( foam, foam_sep_label, imagedev.MarkerBasedWatershedByBlock.REPEATABLE, 256 ) print( "output_binary_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.MarkerBasedWatershedByBlock( foam, foam_sep_label, MarkerBasedWatershedByBlock.AlgorithmMode.REPEATABLE, 256 ); Console.WriteLine( "outputBinaryImage:" + result.ToString() );