#include <string>
#include <math.h>
#include <iostream>
#include <ximage.h>
#include <windows.h>
#include <stdio.h>
#include <iostream>
#define MAX(a, b) (((a) > (b)) ? (a) : (b))
using namespace std;
float GetAbs(float f, float s)
{
float abs = fabs((float)f - (float)s);
float result = MAX(f, s);
if (result == 0)
result = 1;
return abs / result;
}
//相似度
float GetResult(float firstNum[], float scondNum[],int nSize)
{
if (nSize==0)
{
return 0;
}
else
{
float result = 0;
int j = nSize;
for (int i = 0; i < j; i++)
{
result += 1 - GetAbs(firstNum[i], scondNum[i]);
}
return result/j;
}
}
//函数功能:自动普通二值化
//参数说明:iSrc,表示原图像
//iDst,表示目标图像
//nLevel,表示阈值 [OUT]
//iIterationTimes,表示迭代次数
void AutoThreshold(CxImage *iSrc, int &nLevel,CxImage *iDst,int iIterationTimes)
{
void* pDib = NULL;
pDib = iSrc->GetDIB();
if (!pDib)
return ;
if (iSrc->GetBpp()==1)
return ;
- 1
- 2
- 3
- 4
- 5
- 6
前往页