HALCON Reference Manual 10.0.2
Table of Contents / Segmentation / Topography ClassesClassesClasses | | | Operators

watersheds_thresholdwatersheds_thresholdwatersheds_thresholdWatershedsThresholdWatershedsThreshold (Operator)

Name

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

Signature

watersheds_threshold(Image : Basins : Threshold : )

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

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

Herror watersheds_threshold(Hobject Image, Hobject* Basins, const HTuple& Threshold)

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

void HOperatorSetX.WatershedsThreshold(
[in] IHUntypedObjectX* Image, [out] IHUntypedObjectX*Basins, [in] VARIANT Threshold)

IHRegionX* HImageX.WatershedsThreshold([in] VARIANT Threshold)

static void HOperatorSet.WatershedsThreshold(HObject image, out HObject basins, HTuple threshold)

HRegion HImage.WatershedsThreshold(HTuple threshold)

HRegion HImage.WatershedsThreshold(int threshold)

Description

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

In the first step, watersheds_thresholdwatersheds_thresholdwatersheds_thresholdWatershedsThresholdWatershedsThreshold computes the watersheds without applying a threshold, resulting in the same basins that would be obtained when calling watershedswatershedswatershedsWatershedsWatersheds (for more details please refer to the description of watershedswatershedswatershedsWatershedsWatersheds). In the second step, the basins are successively merged if they are separated by a watershed that is smaller than ThresholdThresholdThresholdThresholdthreshold. Let B1 and B2 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

max{W-B1,W-B2} < ThresholdThresholdThresholdThresholdthreshold.

The thus obtained basins are returned in BasinsBasinsBasinsBasinsbasins.

If ThresholdThresholdThresholdThresholdthreshold is set to 0, watersheds_thresholdwatersheds_thresholdwatersheds_thresholdWatershedsThresholdWatershedsThreshold is comparable to watershedswatershedswatershedsWatershedsWatersheds except that no watersheds but only expanded basins are returned. If ThresholdThresholdThresholdThresholdthreshold is set to the maximum gray value range of ImageImageImageImageimage then no two basins are separated by a watershed exceeding ThresholdThresholdThresholdThresholdthreshold, and hence, BasinsBasinsBasinsBasinsbasins will contain only one region.

Parallelization

Parameters

ImageImageImageImageimage (input_object)  image objectHImageHImageHImageXHobject (byte / uint2 / real)

Image to be segmented.

BasinsBasinsBasinsBasinsbasins (output_object)  region-array objectHRegionHRegionArrayHRegionXHobject *

Segments found (dark basins).

ThresholdThresholdThresholdThresholdthreshold (input_control)  number HTupleHTupleVARIANTHtuple (integer / real) (int / long / double) (Hlong / double) (Hlong / double) (Hlong / double)

Threshold for the watersheds.

Default value: 10

Suggested values: 0, 5, 10, 20, 30, 50

Restriction: Threshold >= 0

Result

watershedswatershedswatershedsWatershedsWatersheds 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""no_object_result""no_object_result""no_object_result", 'empty_region_result'"empty_region_result""empty_region_result""empty_region_result""empty_region_result", and 'store_empty_region'"store_empty_region""store_empty_region""store_empty_region""store_empty_region" with set_systemset_systemset_systemSetSystemSetSystem. If necessary, an exception is raised.

Possible Predecessors

binomial_filterbinomial_filterbinomial_filterBinomialFilterBinomialFilter, gauss_imagegauss_imagegauss_imageGaussImageGaussImage, smooth_imagesmooth_imagesmooth_imageSmoothImageSmoothImage, invert_imageinvert_imageinvert_imageInvertImageInvertImage

Possible Successors

expand_regionexpand_regionexpand_regionExpandRegionExpandRegion, select_shapeselect_shapeselect_shapeSelectShapeSelectShape, reduce_domainreduce_domainreduce_domainReduceDomainReduceDomain, openingopeningopeningOpeningOpening

Alternatives

watershedswatershedswatershedsWatershedsWatersheds, pouringpouringpouringPouringPouring

Module

Foundation


Table of Contents / Segmentation / Topography ClassesClassesClasses | | | Operators
HALCON Reference Manual 10.0.2 Copyright © 1996-2011 MVTec Software GmbH