Mamba C API reference

Version 2.0

MB_Api_hierarchical.h File Reference

Go to the source code of this file.

Functions

MB_API_ENTRY MB_errcode MB_API_CALL MB_HierarBld (MB_Image *mask, MB_Image *srcdest, enum MB_grid_t grid)
 
MB_API_ENTRY MB_errcode MB_API_CALL MB_HierarDualBld (MB_Image *mask, MB_Image *srcdest, enum MB_grid_t grid)
 
MB_API_ENTRY MB_errcode MB_API_CALL MB_Watershed (MB_Image *src, MB_Image *marker, Uint32 max_level, enum MB_grid_t grid)
 
MB_API_ENTRY MB_errcode MB_API_CALL MB_Basins (MB_Image *src, MB_Image *marker, Uint32 max_level, enum MB_grid_t grid)
 

Function Documentation

MB_API_ENTRY MB_errcode MB_API_CALL MB_Basins ( MB_Image src,
MB_Image marker,
Uint32  max_level,
enum MB_grid_t  grid 
)

Performs a watershed segmentation of the image using the marker image as a starting point for the flooding. The function returns the catchment basins of the watershed but no actual watershed line. It is recommended to use this functions rather than MB_Watershed if you are only interested in catchment basins (faster).

The result is put into a the 32-bit marker image.

The segmentation is coded as follows into the 32-bit values.

0 1 2 3
<— label —> unused
See also
MB_CopyBytePlane to access each byte individually.
Parameters
srcthe greyscale or 32-bit image to be segmented
markerthe marker image in which the result of segmentation will be put
max_levelthe maximum level reached by the water
gridthe grid used (either square or hexagonal)
Returns
An error code (NO_ERR if successful)
MB_API_ENTRY MB_errcode MB_API_CALL MB_HierarBld ( MB_Image mask,
MB_Image srcdest,
enum MB_grid_t  grid 
)

(re)Builds an image according to a mask image and using a hierarchical list to compute the rebuild.

Parameters
maskthe mask image
srcdestthe rebuild image
gridthe grid used (either square or hexagonal)
Returns
An error code (NO_ERR if successful)
MB_API_ENTRY MB_errcode MB_API_CALL MB_HierarDualBld ( MB_Image mask,
MB_Image srcdest,
enum MB_grid_t  grid 
)

(re)Builds (dual operation) an image according to a mask image and using a hierarchical list to compute the rebuild.

Parameters
maskthe mask image
srcdestthe rebuild image
gridthe grid used (either square or hexagonal)
Returns
An error code (NO_ERR if successful)
MB_API_ENTRY MB_errcode MB_API_CALL MB_Watershed ( MB_Image src,
MB_Image marker,
Uint32  max_level,
enum MB_grid_t  grid 
)

Performs a watershed segmentation of the image using the marker image as a starting point for the flooding. The function builds the actual watershed line (idempotent) plus catchment basins (not idempotent).

The result is put into the 32-bit marker image.

The segmentation is coded as follows into the 32-bit values.

0 1 2 3
<— label —> isLine

isLine is a value indicating if the pixel belongs to the watershed (255 if this is the case, undefined otherwise).

See also
MB_CopyBytePlane to access each byte individually.
Parameters
srcthe greyscale or 32-bit image to segment
markerthe marker image in which the result of segmentation will be put
max_levelthe maximum level reach by the water
gridthe grid used (either square or hexagonal)
Returns
An error code (NO_ERR if successful)