threshold threshold Threshold Threshold (Operator)
Name
threshold threshold Threshold Threshold
— Segment an image using global threshold.
Signature
Description
threshold threshold Threshold Threshold Threshold
selects the pixels from the input image
whose gray values g fulfill the following condition:
All points of an image fulfilling the condition are returned as one
region. If more than one gray value interval is passed (tuples for
MinGray MinGray MinGray MinGray minGray
and MaxGray MaxGray MaxGray MaxGray maxGray
), one separate region is
returned for each interval. For vector field images, the threshold is
not applied to gray values but to the lengths of the vectors.
Attention
For input images of an integer type, floating point values in
MinGray MinGray MinGray MinGray minGray
and MaxGray MaxGray MaxGray MaxGray maxGray
are truncated.
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
Image Image Image Image image
(input_object) singlechannelimage(-array) →
object HImage HImage Hobject (byte / direction / cyclic / int1 / int2 / uint2 / int4 / int8 / real / vector_field)
Input image.
Region Region Region Region region
(output_object) region(-array) →
object HRegion HRegion Hobject *
Segmented region.
MinGray MinGray MinGray MinGray minGray
(input_control) number(-array) →
HTuple HTuple Htuple (real / integer) (double / int / long) (double / Hlong) (double / Hlong)
Lower threshold for the gray values.
Default value: 128.0
Suggested values: 0.0, 10.0, 30.0, 64.0, 128.0, 200.0, 220.0, 255.0
MaxGray MaxGray MaxGray MaxGray maxGray
(input_control) number(-array) →
HTuple HTuple Htuple (real / integer) (double / int / long) (double / Hlong) (double / Hlong)
Upper threshold for the gray values.
Default value: 255.0
Suggested values: 0.0, 10.0, 30.0, 64.0, 128.0, 200.0, 220.0, 255.0
Restriction: MaxGray >= MinGray
Example (HDevelop)
read_image(Image,'fabrik')
sobel_dir(Image,EdgeAmp,EdgeDir,'sum_abs',3)
threshold(EdgeAmp,Seg,50,255)
skeleton(Seg,Rand)
connection(Rand,Lines)
select_shape(Lines,Edges,'area','and',10,1000000)
Example (C)
read_image(&Image,"fabrik");
sobel_amp(Image,&EdgeAmp,"sum_abs",3);
threshold(EdgeAmp,&Seg,50.0,255.0);
skeleton(Seg,&Rand);
connection(Rand,&Lines);
select_shape(Lines,&Edges,"area","and",10.0,1000000.0);
Example (HDevelop)
read_image(Image,'fabrik')
sobel_dir(Image,EdgeAmp,EdgeDir,'sum_abs',3)
threshold(EdgeAmp,Seg,50,255)
skeleton(Seg,Rand)
connection(Rand,Lines)
select_shape(Lines,Edges,'area','and',10,1000000)
Example (HDevelop)
read_image(Image,'fabrik')
sobel_dir(Image,EdgeAmp,EdgeDir,'sum_abs',3)
threshold(EdgeAmp,Seg,50,255)
skeleton(Seg,Rand)
connection(Rand,Lines)
select_shape(Lines,Edges,'area','and',10,1000000)
Example (HDevelop)
read_image(Image,'fabrik')
sobel_dir(Image,EdgeAmp,EdgeDir,'sum_abs',3)
threshold(EdgeAmp,Seg,50,255)
skeleton(Seg,Rand)
connection(Rand,Lines)
select_shape(Lines,Edges,'area','and',10,1000000)
Complexity
Let A be the area of the input region. Then the runtime
complexity is O(A).
Result
threshold threshold Threshold Threshold 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_system set_system SetSystem SetSystem SetSystem
.
If necessary, an exception is raised.
Possible Predecessors
histo_to_thresh histo_to_thresh HistoToThresh HistoToThresh HistoToThresh
,
min_max_gray min_max_gray MinMaxGray MinMaxGray MinMaxGray
,
sobel_amp sobel_amp SobelAmp SobelAmp SobelAmp
,
binomial_filter binomial_filter BinomialFilter BinomialFilter BinomialFilter
,
gauss_filter gauss_filter GaussFilter GaussFilter GaussFilter
,
reduce_domain reduce_domain ReduceDomain ReduceDomain ReduceDomain
,
fill_interlace fill_interlace FillInterlace FillInterlace FillInterlace
Possible Successors
connection connection Connection Connection Connection
,
dilation1 dilation1 Dilation1 Dilation1 Dilation1
,
erosion1 erosion1 Erosion1 Erosion1 Erosion1
,
opening opening Opening Opening Opening
,
closing closing Closing Closing Closing
,
rank_region rank_region RankRegion RankRegion RankRegion
,
shape_trans shape_trans ShapeTrans ShapeTrans ShapeTrans
,
skeleton skeleton Skeleton Skeleton Skeleton
Alternatives
class_2dim_sup class_2dim_sup Class2dimSup Class2dimSup Class2dimSup
,
hysteresis_threshold hysteresis_threshold HysteresisThreshold HysteresisThreshold HysteresisThreshold
,
dyn_threshold dyn_threshold DynThreshold DynThreshold DynThreshold
,
binary_threshold binary_threshold BinaryThreshold BinaryThreshold BinaryThreshold
,
char_threshold char_threshold CharThreshold CharThreshold CharThreshold
,
auto_threshold auto_threshold AutoThreshold AutoThreshold AutoThreshold
,
dual_threshold dual_threshold DualThreshold DualThreshold DualThreshold
See also
zero_crossing zero_crossing ZeroCrossing ZeroCrossing ZeroCrossing
,
background_seg background_seg BackgroundSeg BackgroundSeg BackgroundSeg
,
regiongrowing regiongrowing Regiongrowing Regiongrowing Regiongrowing
Module
Foundation