MIL_ID SrcImageBufId, | //in |
MIL_ID DstImageBufId, | //in |
MIL_INT64 ConditionAndThreshMode, | //in |
MIL_DOUBLE LowParam, | //in |
MIL_DOUBLE HighParam | //in |
This function performs a binary threshold operation on the specified image. Each pixel that meets the specified condition is set to the highest unsigned destination buffer value, while other pixels are set to 0. For example, the highest buffer value for an 8-bit buffer is 0xff (regardless if the source buffer is signed). If a floating-point destination buffer is specified, pixels that meet the condition are set to 1.
There are 5 ways to establish the threshold value(s); two that manually set the threshold value(s) (M_FIXED and M_PERCENTILE_VALUE) and three that automatically base the threshold value(s) on the histogram (M_BIMODAL, M_TRIANGLE_BISECTION_DARK, and M_TRIANGLE_BISECTION_BRIGHT).
When establishing a manually set threshold value (using M_FIXED), the source and destination image buffers can have an ROI set using MbufSetRegion(). The ROI must be defined in raster format (M_RASTER or M_VECTOR_AND_RASTER). An error is generated if the ROI is only in vector format (M_VECTOR).
Specifies the identifier of the data source of the operation. This parameter must be given an image buffer identifier.
When establishing a fixed threshold value, if you specify an image buffer that has an ROI associated with it, the ROI must be in raster format; otherwise, you will get an error.
The source image buffer must be unsigned monochrome 1- (packed binary), 8-, or 16-bit, or M_BGR32 packed.
Specifies the identifier of the destination of the results. In general, this parameter must be given an image buffer identifier.
When establishing a fixed threshold value, if you specify an image buffer that has an ROI associated with it, the ROI must be in raster format; otherwise, you will get an error.
To return only the automatically calculated threshold value, if applicable, set the DstImageBufId parameter to M_NULL. Note that if the DstImageBufId parameter is set to M_NULL, the MimBinarize() function will be forced to run synchronously.
The destination image buffer must be unsigned monochrome 1- (packed binary), 8-, or 16-bit, or M_BGR32 packed. This parameter must not be set to M_NULL.
Specifies the condition, as well as the threshold mode to use to establish the threshold value(s) of the condition.
See the Parameter associations section for possible values that can be specified.
Specifies either the lower limit of the selected condition or the minimum value to use when establishing the threshold.
See the Parameter associations section for possible values that can be specified.
Specifies either the upper limit of the selected condition or the maximum value to use when establishing the threshold.
See the Parameter associations section for possible values that can be specified.
The table below lists possible values for the ConditionAndThreshMode, LowParam, and HighParam parameters.
The following conditions allow you to control the threshold determination mode used.
For controlling the threshold
determination mode
|
|||||||||||||||||||||||||||||||||||||||
ConditionAndThreshMode |
Description
|
||||||||||||||||||||||||||||||||||||||
LowParam | |||||||||||||||||||||||||||||||||||||||
HighParam | |||||||||||||||||||||||||||||||||||||||
M_BIMODAL + |
Specifies to automatically establish the threshold value for the condition from the source image's histogram, using the bimodal threshold mode. (more details...) |
||||||||||||||||||||||||||||||||||||||
LowParam |
Sets the minimum pixel value in the source image's histogram to use when establishing the threshold value. (more details...) |
||||||||||||||||||||||||||||||||||||||
M_NULL |
Specifies to use the full range of pixel values in the histogram. (more details...) |
||||||||||||||||||||||||||||||||||||||
Value |
Specifies the minimum pixel value. (more details...) |
||||||||||||||||||||||||||||||||||||||
HighParam |
Sets the maximum pixel value in the source image's histogram to use when establishing the threshold value. (more details...) |
||||||||||||||||||||||||||||||||||||||
M_NULL |
Specifies to use the full range of pixel values in the histogram. (more details...) |
||||||||||||||||||||||||||||||||||||||
Value |
Specifies the maximum pixel value. (more details...) |
||||||||||||||||||||||||||||||||||||||
M_FIXED + |
Specifies that the threshold value(s) for the condition are specified explicitly. (more details...) |
||||||||||||||||||||||||||||||||||||||
LowParam |
Sets the threshold value to use as the lower limit of the selected condition. (more details...) |
||||||||||||||||||||||||||||||||||||||
HighParam |
Sets the upper limit of the selected condition. (more details...) |
||||||||||||||||||||||||||||||||||||||
M_NULL |
Specifies not to use an upper limit. (more details...) |
||||||||||||||||||||||||||||||||||||||
Value |
Specifies the threshold value to use as the upper limit of the selected condition. (more details...) |
||||||||||||||||||||||||||||||||||||||
M_PERCENTILE_VALUE + |
Specifies that the threshold value(s) for the condition are specified as a percentage of the source image's histogram data. (more details...) |
||||||||||||||||||||||||||||||||||||||
LowParam |
Sets the lower limit of the selected condition. (more details...) |
||||||||||||||||||||||||||||||||||||||
0 <= Value <= 100 |
Specifies the lower limit as a percentage of the source image's histogram data. (more details...) |
||||||||||||||||||||||||||||||||||||||
HighParam |
Sets the upper limit of the selected condition. (more details...) |
||||||||||||||||||||||||||||||||||||||
M_NULL |
Specifies not to use an upper limit. (more details...) |
||||||||||||||||||||||||||||||||||||||
0 <= Value <= 100 |
Specifies the upper limit as a percentage of the source image's histogram data. (more details...) |
||||||||||||||||||||||||||||||||||||||
M_TRIANGLE_BISECTION_BRIGHT + |
Specifies to automatically establish the threshold value for the condition from the source image's histogram, using the bright triangle bisection threshold mode. (more details...) |
||||||||||||||||||||||||||||||||||||||
LowParam |
Sets the minimum pixel value in the source image's histogram to use when establishing the threshold value. (more details...) |
||||||||||||||||||||||||||||||||||||||
M_NULL |
Specifies to use the full range of pixel values in the histogram. (more details...) |
||||||||||||||||||||||||||||||||||||||
Value |
Specifies the minimum pixel value. (more details...) |
||||||||||||||||||||||||||||||||||||||
HighParam |
Sets the maximum pixel value in the source image's histogram to use when establishing the threshold value. (more details...) |
||||||||||||||||||||||||||||||||||||||
M_NULL |
Specifies to use the full range of pixel values in the histogram. (more details...) |
||||||||||||||||||||||||||||||||||||||
Value |
Specifies the maximum pixel value. (more details...) |
||||||||||||||||||||||||||||||||||||||
M_TRIANGLE_BISECTION_DARK + |
Specifies to automatically establish the threshold value for the condition from the source image's histogram, using the dark triangle bisection threshold mode. (more details...) |
||||||||||||||||||||||||||||||||||||||
LowParam |
Sets the minimum pixel value in the source image's histogram to use when establishing the threshold value. (more details...) |
||||||||||||||||||||||||||||||||||||||
M_NULL |
Specifies to use the full range of pixel values in the histogram. (more details...) |
||||||||||||||||||||||||||||||||||||||
Value |
Specifies the minimum pixel value. (more details...) |
||||||||||||||||||||||||||||||||||||||
HighParam |
Sets the maximum pixel value in the source image's histogram to use when establishing the threshold value. (more details...) |
||||||||||||||||||||||||||||||||||||||
M_NULL |
Specifies to use the full range of pixel values in the histogram. (more details...) |
||||||||||||||||||||||||||||||||||||||
Value |
Specifies the maximum pixel value. (more details...) |
You must add one of the following values to the above-mentioned values to specify a threshold condition.
For specifying a threshold
condition
|
|||||||||||||||||||||||||||||||||||||||
Combination value | Description
|
||||||||||||||||||||||||||||||||||||||
M_EQUAL |
Sets pixel values equal to the threshold value to the highest buffer value possible, while other pixels are set to zero. (more details...) |
||||||||||||||||||||||||||||||||||||||
M_GREATER |
Sets pixel values greater than the threshold value to the highest buffer value possible, while other pixels are set to zero. (more details...) |
||||||||||||||||||||||||||||||||||||||
M_GREATER_OR_EQUAL |
Sets pixel values greater than or equal to the threshold value to the highest buffer value possible, while other pixels are set to zero. (more details...) |
||||||||||||||||||||||||||||||||||||||
M_IN_RANGE |
Sets pixels with values between the lower threshold value and the higher threshold value, inclusive, to the highest buffer value. (more details...) |
||||||||||||||||||||||||||||||||||||||
M_LESS |
Sets pixel values less than the threshold value to the highest buffer value possible, while other pixels are set to zero. (more details...) |
||||||||||||||||||||||||||||||||||||||
M_LESS_OR_EQUAL |
Sets pixel values less than or equal to the threshold value to the highest buffer value possible, while other pixels are set to zero. (more details...) |
||||||||||||||||||||||||||||||||||||||
M_NOT_EQUAL |
Sets pixel values not equal to the threshold value to the highest buffer value possible, while other pixels are set to zero. (more details...) |
||||||||||||||||||||||||||||||||||||||
M_OUT_RANGE |
Sets pixels with values less than the lower threshold value or greater than the higher threshold value, to the highest buffer value. (more details...) |
Header | Include mil.h. |
Library | Use mil.lib; milim.lib. |
DLL | Requires mil.dll; milim.dll. |