Operator Reference
Threshold
This chapter describes threshold operators.
Concept of Threshold Operators
One way to perform a segmentation of an image is to use threshold operators. In doing so, regions that fulfill a certain threshold condition, depending on gray values, are determined within an image.
In order to fit different tasks and image properties there is a set of threshold operators provided.
The following paragraphs give an overview of the operators by differentiating them into histogram-based and local methods and having a closer look at the most important ones.
Histogram-based Threshold Operators
Histogram-based threshold segmentation does not take the position but only the pixel value into account. Therefore thresholds are determined by adjusting them to the histogram of an image.
- Threshold
-
By using
, you can select all pixels within user set gray value intervals.threshold
( 1) ( 2) ( 3) The operator
also works with two manually determined thresholds but uses another computing algorithm.fast_threshold
- Binary Threshold
-
To divide your image into light and dark regions,
automatically computes a threshold to separate foreground from background.binary_threshold
( 1) ( 2) ( 3) A segmentation using
also divides the image into foreground and background, but puts out the separating border with sub-pixel accuracy. The threshold has to be set manually.threshold_sub_pix
- Automatic Threshold
-
computes local minima in the image histogram to determine thresholds. By smoothing the histogram you have influence on the number of classes found in the input image.auto_threshold
( 1) ( 2) ( 3) ( 4) ( 1) ( 2) ( 3) Use
to get the gray values of local minima in the histogram.histo_to_thresh
- Character Threshold
-
To do a segmentation of dark text on light background,
is a useful tool. The maximum peak in the histogram corresponds to the light background. Assuming the text is darker than the background, you examine the smoothed histogram left of the maximum. The parameterchar_threshold
determines how far from the maximum the threshold is set, taking the frequencies of the gray values into account.Percent
( 1) ( 2) ( 3) ( 4) - Dual-Threshold
-
Subtracting an image from another or using an edge detecting operator like
usually leads to negative values in the resulting image. The operatorlaplace_of_gauss
is suited for the segmentation of signed images while also taking minimum region size into account.dual_threshold
( 1) ( 2)
Local Threshold Operators
Unlike histogram-based threshold operators, a local threshold also takes position or neighborhood of pixels into account to assign them to the appropriate region. Instead of global thresholds that are applied to each pixel, it is sometimes be useful to adapt the threshold to local features of the image.
- Local Threshold
-
takes the local mean and standard deviation into account and computes an individual threshold for each pixel. The size of the neighborhood is set by the user. This operator is especially suited for the segmentation of text, when lighting conditions or the background are not homogeneous.local_threshold
( 1) ( 2) ( 3) ( 4) The operator
works in a similar way, except it selects those points of the image that fulfill specified conditions regarding their local standard deviation and brightness.var_threshold
- Dynamic Threshold
-
With
you can inspect the differences between images. Usually the input image and a filtered version, e.g., the mean of the image, are compared pixel by pixel. The parameterdyn_threshold
is used to determine what kind of changes in the image are relevant. The sensitivity of the operator is controlled by the parameterLightDark
.Offset
( 1) ( 2) ( 3) ( 4) A similar operator is
. The operator displays the absolute differences between two images. It is especially suited for change detection of consecutively acquired images.check_difference
- Zero Crossing Threshold
-
Operators like
that are used for edge detection return signed images, where edges are located at the zero crossings.laplace_of_gauss
andzero_crossing
can be used to extract those edges, taking the individual 4-neighborhood into account.zero_crossing_sub_pix
( 1) ( 2) ( 3) ( 4)
List of Operators
auto_threshold
- Segment an image using thresholds determined from its histogram.
binary_threshold
- Segment an image using binary thresholding.
char_threshold
- Perform a threshold segmentation for extracting characters.
check_difference
- Compare two images pixel by pixel.
dual_threshold
- Threshold operator for signed images.
dyn_threshold
- Segment an image using a local threshold.
fast_threshold
- Fast thresholding of images using global thresholds.
histo_to_thresh
- Determine gray value thresholds from a histogram.
local_threshold
- Segment an image using local thresholding.
threshold
- Segment an image using global threshold.
threshold_sub_pix
- Extract level crossings from an image with subpixel accuracy.
var_threshold
- Threshold an image by local mean and standard deviation analysis.
zero_crossing
- Extract zero crossings from an image.
zero_crossing_sub_pix
- Extract zero crossings from an image with subpixel accuracy.