| Customize Help
| Save Settings

MimBinarizeAdaptive



Function Map
Synopsis
Perform a point-to-point adaptive binarization on an image.
Syntax
void MimBinarizeAdaptive(
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
)
Description

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.

Note that this function reference has not been updated for a MIL system added during a MIL update. Refer to the MIL system's release note to see which MIL system’s documentation you should use in its place and any possible differences.
Parameters
This function is not supported on the selected boards.
This function reference has not been updated for the selected MIL system. To show the content of this page, choose a second MIL system; refer to the MIL system's release note to see which MIL system’s documentation to choose and any possible differences.
Parameters
AdaptiveBinarizeContextImId

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.

SrcImageBufId

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.

SeedImage1BufId

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:

function map For specifying the first seed image buffer
Click to summarizeValue Description
Click to summarize M_DEFAULT

Establishes seeds automatically.

Click to summarize M_NULL

Specifies to ignore this parameter. Use M_NULL if the context is of type M_BINARIZE_ADAPTIVE_CONTEXT.

(summarize)
Click to summarize MIL image buffer identifier

Specifies the identifier of the first seed 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.

(summarize)
SeedImage2BufId

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:

function map For specifying the second seed image buffer
Click to summarizeValue Description
Click to summarize M_DEFAULT

Establishes seeds automatically. This is only valid if the threshold mode control is set to M_TOGGLE, and the SeedImage1BufId parameter is set to M_DEFAULT.

(summarize)
Click to summarize M_NULL

Specifies to ignore this parameter. Use M_NULL if the threshold mode control is set to M_RECONSTRUCT or M_LEVEL (or the context is of type M_BINARIZE_ADAPTIVE_CONTEXT).

(summarize)
Click to summarize MIL image buffer identifier

Specifies the identifier of the second seed image. This is only valid if the SeedImage1BufId parameter specifies an image buffer identifier, and the threshold mode control is set to M_TOGGLE. 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.

(summarize)
BinarizedImageBufId

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.

ThresholdImageBufId

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.

This parameter must be set to M_NULL if the threshold type (MimControl() with M_THRESHOLD_TYPE) is set to M_IN_RANGE or M_OUT_RANGE.

ControlFlag

Reserved for future expansion and must be set to M_DEFAULT.

Compilation information
Header Include mil.h.
Library Use mil.lib; milim.lib.
DLL Requires mil.dll; milim.dll.
BINARIZE ADAPTIVE CONTEXT BINARIZE ADAPTIVE FROM SEED CONTEXT PROC DEFAULT NULL DEFAULT NULL PROC PROC