Skip to content

watersheds_thresholdWatershedsThresholdWatershedsThresholdwatersheds_thresholdwatersheds_threshold🔗

Short description🔗

watersheds_thresholdWatershedsThresholdWatershedsThresholdwatersheds_thresholdwatersheds_threshold — Extract watershed basins from an image using a threshold.

Signature🔗

watersheds_threshold( image Image, out region Basins, number Threshold )void WatershedsThreshold( const HObject& Image, HObject* Basins, const HTuple& Threshold )static void HOperatorSet.WatershedsThreshold( HObject image, out HObject basins, HTuple threshold )def watersheds_threshold( image: HObject, threshold: Union[float, int] ) -> HObject

Herror watersheds_threshold( const Hobject Image, Hobject* Basins, const Hlong Threshold )

Herror T_watersheds_threshold( const Hobject Image, Hobject* Basins, const Htuple Threshold )

HRegion HImage::WatershedsThreshold( const HTuple& Threshold ) const

HRegion HImage::WatershedsThreshold( Hlong Threshold ) const

HRegion HImage.WatershedsThreshold( HTuple threshold )

HRegion HImage.WatershedsThreshold( int threshold )

Description🔗

The operator watersheds_thresholdWatershedsThreshold segments regions (basins) that are separated from each other by a watershed that has a height of at least Thresholdthresholdthreshold.

In the first step, watersheds_thresholdWatershedsThreshold computes the watersheds without applying a threshold, resulting in the same basins that would be obtained when calling watershedsWatersheds (for more details please refer to the description of watershedsWatersheds). In the second step, the basins are successively merged if they are separated by a watershed that is smaller than Thresholdthresholdthreshold. Let \(B_{1}\) and \(B_{2}\) be the minimum gray values of two neighboring basins and W the minimum gray value of the watershed that separates the two basins. The watershed is eliminated and the two basins are merged if

\[\begin{eqnarray*} \max \{ W-B_{1} , W-B_{2} \} < \textrm{Threshold}. \end{eqnarray*}\]

The thus obtained basins are returned in Basinsbasinsbasins.

If Thresholdthresholdthreshold is set to 00, watersheds_thresholdWatershedsThreshold is comparable to watershedsWatersheds except that no watersheds but only expanded basins are returned. If Thresholdthresholdthreshold is set to the maximum gray value range of Imageimageimage then no two basins are separated by a watershed exceeding Thresholdthresholdthreshold, and hence, Basinsbasinsbasins will contain only one region.

Execution information🔗

Execution information
  • Multithreading type: reentrant (runs in parallel with non-exclusive operators).

  • Multithreading scope: global (may be called from any thread).

  • Processed without parallelization.

Parameters🔗

Imageimageimage (input_object) singlechannelimage → object (byte / uint2 / real)HObject (byte / uint2 / real)HImage (byte / uint2 / real)HObject (byte / uint2 / real)Hobject (byte / uint2 / real)

Image to be segmented.

Basinsbasinsbasins (output_object) region-array → objectHObjectHRegionHObjectHobject *

Segments found (dark basins).

Thresholdthresholdthreshold (input_control) number → (integer / real)HTuple (Hlong / double)HTuple (int / long / double)Union[float, int]Htuple (Hlong / double)

Threshold for the watersheds.

Default: 1010
Suggested values: 0, 5, 10, 20, 30, 500, 5, 10, 20, 30, 50
Restriction: Threshold >= 0

Result🔗

watershedsWatersheds always returns 2 (H_MSG_TRUE). The behavior with respect to the input image and output regions can be determined by setting the values of the flags 'no_object_result'"no_object_result", 'empty_region_result'"empty_region_result", and 'store_empty_region'"store_empty_region" with set_systemSetSystem. If necessary, an exception is raised.

Combinations with other operators🔗

Combinations

Possible predecessors

binomial_filterBinomialFilter, gauss_filterGaussFilter, smooth_imageSmoothImage, invert_imageInvertImage

Possible successors

expand_regionExpandRegion, select_shapeSelectShape, reduce_domainReduceDomain, openingOpening

Alternatives

watershedsWatersheds, pouringPouring, watersheds_markerWatershedsMarker

Module🔗

Foundation