threshold ( Image : Region : MinGray, MaxGray : )

Segment an image using global threshold.

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

             MinGray <= g <=  MaxGray .

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 and MaxGray), one separate region is returned for each interval.


Parameters

Image (input_object)
image(-array) -> object : byte / direction / cyclic / int1 / int2 / uint2 / int4 / real / dvf
Input image.

Region (output_object)
region(-array) -> object
Segmented region.

MinGray (input_control)
number(-array) -> real / integer
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 (input_control)
number(-array) -> real / integer
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
read_image(Image,'fabrik') 
sobel_dir(Image,EdgeAmp,EdgeDir,'sum_abs',3) 
threshold(EdgeAmp,Seg,50,255,2) 
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 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', 'empty_region_result', and 'store_empty_region' with set_system. If necessary, an exception is raised.


Parallelization Information

threshold is reentrant and automatically parallelized (on tuple level, domain level).


Possible Predecessors

histo_to_thresh, min_max_gray, sobel_amp, gauss_image, reduce_domain, fill_interlace


Possible Successors

connection, dilation1, erosion1, opening, closing, rank_region, shape_trans, skeleton


Alternatives

class_2dim_sup, hysteresis_threshold, dyn_threshold, bin_threshold, char_threshold, auto_threshold, dual_threshold


See also

zero_crossing, background_seg, regiongrowing


Module

Foundation



Copyright © 1996-2008 MVTec Software GmbH