This interface provide functionalities of threshold operations. More...
Public Member Functions | |
void | Binarize (ILImage *img, ILImage *result) |
void | Clip (ILImage *img, ILImage *result) |
void | SetThreshold (int lb, int ub) |
void | SetThresholdAdaptGlobal (int lbBias, int ubBias) |
void | SetThresholdAdaptLocal (int blockWidth, int blockHeight, int lbBias, int ubBias) |
void | Stretch (ILImage *img, ILImage *result) |
void | ThresholdDistance (ILImage *img, ILImage *result) |
Public Member Functions inherited from ILObject | |
ILObject * | Copy () |
LPVErrorCode | Load (LString filename) |
void | Reset () |
LPVErrorCode | Save (LString filename) |
BOOL | Valid () |
Properties | |
int | LocalBlockHeight [get] |
The height of the local region used in local adaptive thresholding. More... | |
int | LocalBlockWidth [get] |
The width of the local region used in local adaptive thresholding. More... | |
int | ThresholdLB [get] |
The lower bound of used-specified threshold value. More... | |
int | ThresholdLBBias [get] |
The revised value to generate a adaptive threshold lower bound. More... | |
LPVThresholdType | ThresholdType [get] |
The thresholding method. More... | |
int | ThresholdUB [get] |
The upper bound of used-specified threshold value. More... | |
int | ThresholdUBBias [get] |
The revised value to generate a adaptive threshold upper bound. More... | |
This interface provide functionalities of threshold operations.
Thresholding is a classic segmentation method to separate out regions of an image corresponding to objects which we want to analyze. This separation is based on the variation of intensity between the object and the background pixels. To differentiate the pixels, we perform a comparison of each pixel intensity value with respect to a threshold value (which is user-specified or determined by adaptive method)
To use this interface, you should create a LImageThreshold object.
Binarize the input image and return the result new image.
If the lower bound of threshold value is smaller than the upper bound, pixels within the lower and upper bound of threshold value is set to the object level (maximum value, 255 for 8bit images, 65536 for 16bit images), otherwise, the output pixel is set to the background level (0).
If the lower bound of threshold value is greater than the upper bound, the output result is inverted.
[in] | img | The input image |
[out] | result | Return result image |
Pixels within the lower and upper bound of threshold value is assigned the value of the input pixel, otherwise, is assigned to the value of lower or upper bound.
For example, if the threshold lower bound is 100, upper bound is 200, a pixel of 150 value remains 150, a pixel of 230 outputs 200, a pixel of 50 outputs 100.
[in] | img | The input image |
[out] | result | Return result image |
void SetThreshold | ( | int | lb, |
int | ub | ||
) |
Use user-specified threshold value
[in] | lb | The lower bound of threshold range, in range of 0 ~ 255 for 8bit images, 0 ~ 65535 for 16bit images |
[in] | ub | The upper bound of threshold range, in range of 0 ~ 255 for 8bit images, 0 ~ 65535 for 16bit images |
void SetThresholdAdaptGlobal | ( | int | lbBias, |
int | ubBias | ||
) |
Use global-adaptive threshold value.
The optimal threshold value is calculated base on the entire input image, then revised by the given bias value. The lower bound of threshold value is \( t - lbBias \) , the upper bound is \( t + ubBias \) .
[in] | lbBias | Revise value to optimal threshold value, to generate a threshold lower bound. |
[in] | ubBias | Revise value to optimal threshold value, to generate a threshold upper bound. |
void SetThresholdAdaptLocal | ( | int | blockWidth, |
int | blockHeight, | ||
int | lbBias, | ||
int | ubBias | ||
) |
Use local-adaptive threshold value.
The optimal threshold value is calculated base on a \( blockWidth \times blockHeight \) region around individual pixel, then revised by the given bias value. The lower bound of threshold value is \( t - lbBias \) , the upper bound is \( t + ubBias \) .
[in] | blockWidth | The width of a pixel's local region, should be an odd number, say, 3, 5, 7, etc. |
[in] | blockHeight | The height of a pixel's local region, should be an odd number, say, 3, 5, 7, etc. |
[in] | lbBias | Revise value to optimal threshold value, to generate a threshold lower bound. |
[in] | ubBias | Revise value to optimal threshold value, to generate a threshold upper bound. |
Stretch the pixel value within the lower and upper bound of threshold value, others is assigned to 0 or maximum value respectively.
For example for a 8bit image, if the threshold lower bound is 100, upper bound is 200, pixel is assigned to 0 if its input value is within range [0, 100], it's assigned to 255 if within range [200, 255], for the range [101, 199] it's assigned as:
\[ (p - 100) \times 255 / (200 - 100) \]
[in] | img | The input image |
[out] | result | Return result image |
Each output pixel represents the difference between the greyscale value of each input pixel and the threshold lower bound.
For example, if a pixel value is 100 and the threshold lower bound is 25, then the output pixel value will be 75。
[in] | img | The input image |
[out] | result | Return result image |
|
get |
The height of the local region used in local adaptive thresholding.
|
get |
The width of the local region used in local adaptive thresholding.
|
get |
The lower bound of used-specified threshold value.
|
get |
The revised value to generate a adaptive threshold lower bound.
|
get |
The thresholding method.
|
get |
The upper bound of used-specified threshold value.
|
get |
The revised value to generate a adaptive threshold upper bound.