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).
You can limit this function's results to a region of an image buffer using a region of interest (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.
This image buffer 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 destination image buffer in which to write the results. In general, this parameter must be given an image buffer identifier.
This image buffer 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).
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.
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. This threshold mode can only be used if the condition uses one limit. In this mode, if the source image's histogram contains only two peaks, the threshold value is set to the intensity value at the lowest point between these two peaks of the histogram, on the assumption that these peaks represent the object and the background. If the histogram contains more than two peaks, the threshold value will typically be set between the intensity values at the two principal peaks, although exceptions exist for the situations where the principal peaks occur are closest to the minimum intensity value (pure black) or the maximum intensity value (full saturation). Note that the bimodal threshold mode works best when the histogram contains two visible peaks. You can limit the intensity value range of the histogram from which the threshold value is established. To do so, use the LowParam and HighParam parameters. You must specify a combination value from the following table: 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. (summarize)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. This setting is only valid when HighParam is also set to M_NULL. (summarize)Specifies to use the full range of pixel values in the histogram. (more details...) |
||||||||||||||||||||||||||||||||||||||
Value |
Specifies the minimum pixel value. The minimum value must be less than or equal to the maximum value. (summarize)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. (summarize)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. This setting is only valid when LowParam is also set to M_NULL. (summarize)Specifies to use the full range of pixel values in the histogram. (more details...) |
||||||||||||||||||||||||||||||||||||||
Value |
Specifies the maximum pixel value. The maximum value must be greater than or equal to the minimum value. (summarize)Specifies the maximum pixel value. (more details...) |
||||||||||||||||||||||||||||||||||||||
M_FIXED + |
Specifies that the threshold value(s) for the condition are specified explicitly. You must specify a combination value from the following table: 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. The lower limit must be less than or equal to the upper limit. (summarize)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. (summarize)Sets the upper limit of the selected condition. (more details...) |
||||||||||||||||||||||||||||||||||||||
M_NULL |
Specifies not to use an upper limit. Use this setting when the condition uses only one limit. (summarize)Specifies not to use an upper limit. (more details...) |
||||||||||||||||||||||||||||||||||||||
Value |
Specifies the threshold value to use as the upper limit of the selected condition. The upper limit must be greater than or equal to the lower limit. (summarize)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. In this mode, you specify a threshold value by specifying the percentage of pixels that must be equal to or less than the required threshold value. You must specify a combination value from the following table: 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. (summarize)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. The lower limit must be less than or equal to the upper limit. (summarize)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. (summarize)Sets the upper limit of the selected condition. (more details...) |
||||||||||||||||||||||||||||||||||||||
M_NULL |
Specifies not to use an upper limit. Use this setting when the condition uses only one limit. (summarize)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. The upper limit must be greater than or equal to the lower limit. (summarize)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. This threshold mode can only be used if the condition uses one limit. In bright triangular bisection threshold mode, MIL establishes the tallest peak in the source image's histogram (the most commonly-occurring value) and the lowest point (the least commonly-occurring value) when heading from the peak toward its maximum intensity value. It then connects these two points by a line. The threshold value is the intensity value at the point furthest below that line (the inflection point). Note that all points above the line are ignored. You can limit the intensity value range of the histogram from which the threshold value is established. To do so, use the LowParam and HighParam parameters. You must specify a combination value from the following table: 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. (summarize)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. This setting is only valid when HighParam is also set to M_NULL. (summarize)Specifies to use the full range of pixel values in the histogram. (more details...) |
||||||||||||||||||||||||||||||||||||||
Value |
Specifies the minimum pixel value. The minimum value must be less than or equal to the maximum value. (summarize)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. (summarize)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. This setting is only valid when LowParam is also set to M_NULL. (summarize)Specifies to use the full range of pixel values in the histogram. (more details...) |
||||||||||||||||||||||||||||||||||||||
Value |
Specifies the maximum pixel value. The maximum value must be greater than or equal to the minimum value. (summarize)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. This threshold mode can only be used if the condition uses one limit. In dark triangular bisection threshold mode, MIL establishes the tallest peak in the source image's histogram (the most commonly-occurring value) and the lowest point (the least commonly-occurring value) when heading from the peak toward its minimum intensity value. It then connects these two points by a line. The threshold value is the intensify value at the point furthest below that line (the inflection point). Note that all points above the line are ignored. You can limit the intensity value range of the histogram from which the threshold value is established. To do so, use the LowParam and HighParam parameters. You must specify a combination value from the following table: 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. (summarize)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. This setting is only valid when HighParam is also set to M_NULL. (summarize)Specifies to use the full range of pixel values in the histogram. (more details...) |
||||||||||||||||||||||||||||||||||||||
Value |
Specifies the minimum pixel value. The minimum value must be less than or equal to the maximum value. (summarize)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. (summarize)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. This setting is only valid when LowParam is also set to M_NULL. (summarize)Specifies to use the full range of pixel values in the histogram. (more details...) |
||||||||||||||||||||||||||||||||||||||
Value |
Specifies the maximum pixel value. The maximum value must be greater than or equal to the minimum value. (summarize)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
|
|||||||||||||||||||||||||||||||||||||||
|
Description | ||||||||||||||||||||||||||||||||||||||
M_EQUAL |
Sets pixel values equal to the threshold value to the highest buffer value possible, while other pixels are set to zero. Note that if using a floating-point destination buffer, pixels that meet the condition are set to 1. (summarize)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. Note that if using a floating-point destination buffer, pixels that meet the condition are set to 1. (summarize)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. Note that if using a floating-point destination buffer, pixels that meet the condition are set to 1. (summarize)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. Other pixels are set to 0. Note that this is only applicable to constants that can use two limits (M_FIXED and M_PERCENTILE_VALUE). If a floating-point destination buffer is specified, pixels that meet the condition are set to 1. (summarize)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. Note that if using a floating-point destination buffer, pixels that meet the condition are set to 1. (summarize)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. Note that if using a floating-point destination buffer, pixels that meet the condition are set to 1. (summarize)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. Note that if using a floating-point destination buffer, pixels that meet the condition are set to 1. (summarize)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. Other pixels are set to 0. Note that this is only applicable to constants that can use two limits (M_FIXED and M_PERCENTILE_VALUE). If a floating-point destination buffer is specified, pixels that meet the condition are set to 1. (summarize)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. |