Threshold
Grayscale image into a binary image by setting a specific threshold value or algorithm.
ðžïļ Image options and parameters of threshold
method
Thresholding is a common image processing technique used to segment an image into regions based on pixel intensity values. The goal of thresholding is to separate objects or features of interest from the background or noise by setting a threshold value that divides the pixel values into two groups: those above the threshold and those below it. Thresholding is widely used for tasks like object detection, image segmentation, and feature extraction.
Kinds of images compatible with algorithmâ
Image property | What it means | Possible values |
---|---|---|
bitDepth | number of bits per channel | [8,16] |
components | number of components | [1] |
alpha | is alpha channel allowed | false |
Parameters and default valuesâ
With threshold filter there are two ways of passing options: by passing threshold coefficient manually and by calculating threshold with an algorithm.
options
Threshold Variant:â
Property | Required | Default value |
---|---|---|
threshold | no | - |
out | no | - |
Threshold Algorithm Variantâ
Property | Required | Default value |
---|---|---|
algorithm | no | otsu |
out | no | - |
List of threshold algorithms:â
huang
intermodes
isodata
li
maxEntropy
mean
mean
minimum
minError
moments
otsu
percentile
renyiEntropy
shanbhag
triangle
yen
Implementation
Here's how thresholding works:
Choose a threshold value: This value is determined based on the characteristics of the image and the desired segmentation outcome. It can be chosen manually or automatically using various algorithms.
Compare each pixel's intensity value with the threshold value: If the pixel value is greater than or equal to the threshold value, it is assigned to one group (foreground or object). If the pixel value is less than the threshold value, it is assigned to the other group (background).
Generate a binary image: The result of thresholding is a binary image(mask) where pixels belonging to the foreground are assigned a value of 1 (white) and pixels belonging to the background are assigned a value of 0 (black).