MIL_ID AdaptiveBinarizeContextImId, | //in |
MIL_ID SrcImageBufId, | //in |
MIL_ID SeedImage1BufId, | //in |
MIL_ID SeedImage2BufId, | //in |
MIL_ID BinarizedImageBufId, | //in |
MIL_ID ThresholdImageBufId, | //in |
MIL_INT64 ControlFlag | //in |
This function performs an adaptive binary threshold operation on the specified image and places the resulting binarized image in the specified buffer. This function also provides the threshold values with which it binarized the image.
To perform the adaptive binarization, this function establishes a threshold value for each pixel in the source, according to the context's threshold mode. Each source pixel that is greater than its corresponding threshold value is set to the highest unsigned destination buffer value. For example, for 1-, 8-, and 16-bit destination buffers (signed or unsigned), the highest values are 1, 0xFF, and 0xFFFF, respectively. For 32-bit floating-point destination buffers, the highest value is 1. Source pixels that are less than or equal to their corresponding threshold value are set to 0, for destination buffers of any type.
To specify a particular mode with which to calculate threshold values, call MimControl() with M_THRESHOLD_MODE. Available threshold modes generally refer to adaptive algorithms, which perform multiple calculations on individual sections of an image. When compared to a conventional binarization (MimBinarize()), which calculates threshold values using an image as a whole, an adaptive binarization is more robust at processing images with objects that are difficult to identify. Such difficulties typically come from changes in illumination and poor or varying contrast. This type of robustness can cause an adaptive binarization to take longer to execute than a conventional one.
You can modify controls other than threshold mode to customize calculations, such as indicating a maximum (M_GLOBAL_MAX) or minimum (M_GLOBAL_MIN) threshold value. Available controls depend on the type of the adaptive binarization context.
Image buffers specified with this function can be grayscale or color. 1-bit, 8-bit, and 16-bit buffers are supported; their type can be signed or unsigned. 32-bit buffers are also supported; their type must be float. For best results, all image buffers should have the same number of bands and be the same type.
Specifies the identifier of the adaptive binarization context. The context must have been allocated using MimAlloc() with either M_BINARIZE_ADAPTIVE_CONTEXT or M_BINARIZE_ADAPTIVE_FROM_SEED_CONTEXT.
Specifies the identifier of the source image buffer with which to perform the adaptive binarization. This image buffer must not have a region of interest (ROI) associated with it. Using an image buffer with an ROI will cause an error.
Specifies the identifier of the image buffer to use as the first seed image. If the type of the specified context is M_BINARIZE_ADAPTIVE_FROM_SEED_CONTEXT, this function uses seeds as positional information in the source image to establish threshold values, given the threshold mode control (M_THRESHOLD_MODE). For contexts of type M_BINARIZE_ADAPTIVE_CONTEXT, seed information is not required; set this parameter to M_NULL.
For contexts of type M_BINARIZE_ADAPTIVE_FROM_SEED_CONTEXT, set this parameter to one of the following:
For specifying the first seed image
buffer
|
|||||||||||||||||||||||||||||||||||||||
Value | Description
|
||||||||||||||||||||||||||||||||||||||
M_DEFAULT |
Establishes seeds automatically. |
||||||||||||||||||||||||||||||||||||||
M_NULL |
Specifies to ignore this parameter. (more details...) |
||||||||||||||||||||||||||||||||||||||
MIL image buffer identifier |
Specifies the identifier of the first seed image. (more details...) |
Specifies the identifier of the image buffer to use as the second seed image. If the type of the specified context is M_BINARIZE_ADAPTIVE_FROM_SEED_CONTEXT, this function uses seeds as positional information in the source image to establish threshold values, given the threshold mode control (M_THRESHOLD_MODE). For contexts of type M_BINARIZE_ADAPTIVE_CONTEXT, seed information is not required; set this parameter to M_NULL.
For contexts of type M_BINARIZE_ADAPTIVE_FROM_SEED_CONTEXT, set this parameter to one of the following:
For specifying the second seed image
buffer
|
|||||||||||||||||||||||||||||||||||||||
Value | Description
|
||||||||||||||||||||||||||||||||||||||
M_DEFAULT |
Establishes seeds automatically. (more details...) |
||||||||||||||||||||||||||||||||||||||
M_NULL |
Specifies to ignore this parameter. (more details...) |
||||||||||||||||||||||||||||||||||||||
MIL image buffer identifier |
Specifies the identifier of the second seed image. (more details...) |
Specifies the identifier of the image buffer in which to put the result of the adaptive binarization operation. This image buffer must not have a region of interest (ROI) associated with it. Using an image buffer with an ROI will cause an error. To not generate the binarized image result, set this parameter to M_NULL. This is only valid if the ThresholdImageBufId parameter is not set to M_NULL.
Specifies the identifier of the image buffer in which to put the resulting threshold values with which to binarize the source image. This image buffer must not have a region of interest (ROI) associated with it. Using an image buffer with an ROI will cause an error. To not generate the threshold image result, set this parameter to M_NULL. This is only valid if the BinarizedImageBufId parameter is not also set to M_NULL.
Header | Include mil.h. |
Library | Use mil.lib; milim.lib. |
DLL | Requires mil.dll; milim.dll. |