MimBinarize转二值图

MimBinarize()函数

Synopsis

Perform a point-to-point binary thresholding operation.

Format

void MimBinarize(SrcImageBufId, DestImageBufId, Condition, CondLow, CondHigh)

MIL_ID SrcImageBufId;??? Source image buffer identifier
MIL_ID DestImageBufId;??? Destination image buffer identifier
long Condition;??? Conditional operator for selection
double CondLow;??? Low compare value for the condition
double CondHigh;??? High compare value for the condition

Description

This function performs binary thresholding 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.
The SrcImageBufId parameter specifies the identifier of the data source of the operation. This parameter must be given an image buffer identifier.
The DestImageBufId parameter specifies the identifier of the destination of the results. This parameter must be given an image buffer identifier.

The Condition parameter specifies the thresholding condition. This parameter can be set to one of two types of conditions.

Conditions that use two limits (CondLow and CondHigh): M_OUT_RANGE(以外), M_IN_RANGE(以内),
Conditions that use one limit (CondLow):
M_EQUAL(相等), M_NOT_EQUAL(不等), M_GREATER, M_LESS, M_GREATER_OR_EQUAL(大于或等于), M_LESS_OR_EQUAL.

When the M_OUT_RANGE condition is selected, pixels with values less than CondLow, or greater than CondHigh, are set to the highest buffer value, while other pixels are set to zero (0).

When the M_IN_RANGE condition is selected, pixels with values from CondLow to CondHigh, inclusive,? are set to the highest buffer value, while other pixels are set to zero (0).

When you select any of the other conditions, if the condition applied to the pixel is true, that pixel is set to the highest buffer value, while other pixels are set to zero (0).

If a floating point destination buffer is specified, pixels that meet the condition are set to one (1).

The CondLow and CondHigh parameters specify the upper and lower limits of the selected condition. If the condition uses only one limit, set the CondLow parameter to the required limit and set CondHigh to M_NULL. Note, if the source buffer is binary, CondLow and CondHigh must be equal to 0 or 1.

Note

This function is optimized for packed binary buffers.

Status

In-place processing is supported (source equals destination), but the source and destination image buffers cannot partially overlap (a situation that can only occur when using child buffers).

Status

In-place processing is supported (source equals destination), but the source and destination image buffers cannot partially overlap (a situation that can only occur when using child buffers).

注:用于灰度图转二值图,例如阈值 thre

M_OUT_RANGE:? 小于阈值 thre-CondLow,大于阈值 thre+CondHigh,像素为1
M_IN_RANGE:??? 大于阈值 thre-CondLow,小于阈值 thre+CondHigh,像素为1
M_EQUAL:?? 等于阈值 thre,像素为1
M_NOT_EQUAL: 不等于阈值 thre,像素为1
M_GREATER:?? 大于阈值 thre,像素为1
M_LESS:?? 小于阈值 thre,像素为1
M_GREATER_OR_EQUAL:? 大于等于阈值 thre,像素为1
M_LESS_OR_EQUAL:?? 小于等于阈值 thre,像素为1

《MimBinarize转二值图》上有28条评论

评论已关闭。