MimBinarize转二值图

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.

灰度图转二值图阈(阀)值方法介绍

灰度平均值的阈值

将一幅图所有像素值加总除以总像素个数,得到平均值,这种方法最简单但有很多盲区,一般用来做初始分割的猜测值。

谷底最小值的阈值

用于具有明显双峰直方图的图像,其寻找双峰的谷底作为阈值,但是该方法不一定能获得阈值,对于那些具有平坦的直方图或单峰图像,该方法不合适。

百分比阈值

Doyle于1962年提出的P-Tile (即P分位数法)可以说是最古老的一种阈值选取方法。该方法根据先验概率来设定阈值,使得二值化后的目标或背景像素比例等于先验概率,该方法简单高效,但是对于先验概率难于估计的图像却无能为力。