Operator Reference

fast_thresholdfast_thresholdFastThresholdFastThresholdfast_threshold (Operator)

fast_thresholdfast_thresholdFastThresholdFastThresholdfast_threshold — Fast thresholding of images using global thresholds.

Signature

fast_threshold(Image : Region : MinGray, MaxGray, MinSize : )

Herror fast_threshold(const Hobject Image, Hobject* Region, double MinGray, double MaxGray, const Hlong MinSize)

Herror T_fast_threshold(const Hobject Image, Hobject* Region, const Htuple MinGray, const Htuple MaxGray, const Htuple MinSize)

void FastThreshold(const HObject& Image, HObject* Region, const HTuple& MinGray, const HTuple& MaxGray, const HTuple& MinSize)

HRegion HImage::FastThreshold(const HTuple& MinGray, const HTuple& MaxGray, Hlong MinSize) const

HRegion HImage::FastThreshold(double MinGray, double MaxGray, Hlong MinSize) const

static void HOperatorSet.FastThreshold(HObject image, out HObject region, HTuple minGray, HTuple maxGray, HTuple minSize)

HRegion HImage.FastThreshold(HTuple minGray, HTuple maxGray, int minSize)

HRegion HImage.FastThreshold(double minGray, double maxGray, int minSize)

def fast_threshold(image: HObject, min_gray: Union[int, float], max_gray: Union[int, float], min_size: int) -> HObject

Description

fast_thresholdfast_thresholdFastThresholdFastThresholdfast_threshold selects the pixels from the input image whose gray values g fulfill the following condition:

To reduce the processing time, the selection is done in two steps: At first, all points lying on selected horizontal lines that are specified by their distance MinSizeMinSizeMinSizeminSizemin_size are processed. In the next step the neighborhood (size (2*MinSize+1) x (2*MinSize+1)) of all previously selected points are processed.

Attention

On multi-core computers supporting the SSE2 instruction set, thresholdthresholdThresholdThresholdthreshold is most likely faster than fast_thresholdfast_thresholdFastThresholdFastThresholdfast_threshold. fast_thresholdfast_thresholdFastThresholdFastThresholdfast_threshold may only be preferred to thresholdthresholdThresholdThresholdthreshold if those features are not available, e.g., on embedded platforms.

Execution Information

  • Multithreading type: reentrant (runs in parallel with non-exclusive operators).
  • Multithreading scope: global (may be called from any thread).
  • Automatically parallelized on tuple level.
  • Automatically parallelized on internal data level.

Parameters

ImageImageImageimageimage (input_object)  singlechannelimage(-array) objectHImageHObjectHObjectHobject (byte / uint2 / direction / cyclic / real)

Input image.

RegionRegionRegionregionregion (output_object)  region(-array) objectHRegionHObjectHObjectHobject *

Segmented regions.

MinGrayMinGrayMinGrayminGraymin_gray (input_control)  number HTupleUnion[int, float]HTupleHtuple (real / integer) (double / int / long) (double / Hlong) (double / Hlong)

Lower threshold for the gray values.

Default: 128

Suggested values: 0.0, 10.0, 30.0, 64.0, 128.0, 200.0, 220.0, 255.0

Value range: 0.0 ≤ MinGray MinGray MinGray minGray min_gray ≤ 255.0 (lin)

Minimum increment: 1

Recommended increment: 5.0

MaxGrayMaxGrayMaxGraymaxGraymax_gray (input_control)  number HTupleUnion[int, float]HTupleHtuple (real / integer) (double / int / long) (double / Hlong) (double / Hlong)

Upper threshold for the gray values.

Default: 255.0

Suggested values: 0.0, 10.0, 30.0, 64.0, 128.0, 200.0, 220.0, 255.0

Value range: 0.0 ≤ MaxGray MaxGray MaxGray maxGray max_gray ≤ 255.0 (lin)

Minimum increment: 1

Recommended increment: 5.0

MinSizeMinSizeMinSizeminSizemin_size (input_control)  number HTupleintHTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Minimum size of objects to be extracted.

Default: 20

Suggested values: 5, 10, 15, 20, 25, 30, 40, 50, 60, 70, 100

Value range: 2 ≤ MinSize MinSize MinSize minSize min_size ≤ 200 (lin)

Minimum increment: 1

Recommended increment: 2

Complexity

Let A be the area of the output region and height the height of ImageImageImageimageimage. Then the runtime complexity is O(A + height / MinSizeMinSizeMinSizeminSizemin_size).

Result

fast_thresholdfast_thresholdFastThresholdFastThresholdfast_threshold returns 2 ( H_MSG_TRUE) if all parameters are correct. The behavior with respect to the input images 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_systemSetSystemSetSystemset_system. If necessary, an exception is raised.

Possible Predecessors

histo_to_threshhisto_to_threshHistoToThreshHistoToThreshhisto_to_thresh, min_max_graymin_max_grayMinMaxGrayMinMaxGraymin_max_gray, sobel_ampsobel_ampSobelAmpSobelAmpsobel_amp, binomial_filterbinomial_filterBinomialFilterBinomialFilterbinomial_filter, gauss_filtergauss_filterGaussFilterGaussFiltergauss_filter, reduce_domainreduce_domainReduceDomainReduceDomainreduce_domain, fill_interlacefill_interlaceFillInterlaceFillInterlacefill_interlace

Possible Successors

connectionconnectionConnectionConnectionconnection, dilation1dilation1Dilation1Dilation1dilation1, erosion1erosion1Erosion1Erosion1erosion1, openingopeningOpeningOpeningopening, closingclosingClosingClosingclosing, rank_regionrank_regionRankRegionRankRegionrank_region, shape_transshape_transShapeTransShapeTransshape_trans, skeletonskeletonSkeletonSkeletonskeleton

Alternatives

thresholdthresholdThresholdThresholdthreshold, gen_grid_regiongen_grid_regionGenGridRegionGenGridRegiongen_grid_region, dilation_rectangle1dilation_rectangle1DilationRectangle1DilationRectangle1dilation_rectangle1, dyn_thresholddyn_thresholdDynThresholdDynThresholddyn_threshold

See also

class_2dim_supclass_2dim_supClass2dimSupClass2dimSupclass_2dim_sup, hysteresis_thresholdhysteresis_thresholdHysteresisThresholdHysteresisThresholdhysteresis_threshold

Module

Foundation