⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 arithtest.cpp

📁 由visual c++编写的北航一个的指纹识别系统
💻 CPP
字号:
// ArithTest.cpp : implementation file
//

#include "stdafx.h"
#include "FingerDemo.h"
#include "ArithTest.h"
#include "fingerdll.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CArithTest
extern CFingerDemoApp theApp;

IMPLEMENT_DYNCREATE(CArithTest, CFormView)

CArithTest::CArithTest()
	: CFormView(CArithTest::IDD)
{
	//{{AFX_DATA_INIT(CArithTest)
	m_nAll_Num = 0;
	m_fAverTime = 0.0f;
	m_nSampleSize = theApp.num ;
	m_nShiBieNum = 0;
	m_fShiBieRe = 0.0f;
	m_nSampleSizeA = 0;
	m_nSampleSizeB = 0;
	m_nSampleSizeC = 0;
	m_fWuShiRe = 0.0f;
	m_nWuShiNum = 0;
	//}}AFX_DATA_INIT
	FPTEST *tmp;
	if(theApp.testdb)
	{
		tmp=theApp.testdb;
		for(int i=0;i<theApp.num;i++)
		{
			if(tmp->quality==1)
				this->m_nSampleSizeA++;
			else if(tmp->quality==2)
				this->m_nSampleSizeB++;
			else
			    this->m_nSampleSizeC++;
			tmp++;
		}
	}

	theApp.m_bArithTest=true;
	theApp.m_pArithTest=this;
}

CArithTest::~CArithTest()
{
	theApp.m_bArithTest=false;

}

void CArithTest::DoDataExchange(CDataExchange* pDX)
{
	CFormView::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CArithTest)
	DDX_Text(pDX, IDC_ALL_NUM, m_nAll_Num);
	DDX_Text(pDX, IDC_AVER_TIME, m_fAverTime);
	DDX_Text(pDX, IDC_SANPLE_SIZE, m_nSampleSize);
	DDX_Text(pDX, IDC_SHIBIE_NUM, m_nShiBieNum);
	DDX_Text(pDX, IDC_SHIBIE_RESULT, m_fShiBieRe);
	DDX_Text(pDX, IDC_SIZE_A, m_nSampleSizeA);
	DDX_Text(pDX, IDC_SIZE_B, m_nSampleSizeB);
	DDX_Text(pDX, IDC_SIZE_C, m_nSampleSizeC);
	DDX_Text(pDX, IDC_WUSHI_RESULT, m_fWuShiRe);
	DDX_Text(pDX, IDC_WUSHI_NUM, m_nWuShiNum);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CArithTest, CFormView)
	//{{AFX_MSG_MAP(CArithTest)
	ON_BN_CLICKED(IDC_BEGIN_TEST, OnBeginTest)
	ON_WM_ERASEBKGND()
	ON_WM_CTLCOLOR()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CArithTest diagnostics

#ifdef _DEBUG
void CArithTest::AssertValid() const
{
	CFormView::AssertValid();
}

void CArithTest::Dump(CDumpContext& dc) const
{
	CFormView::Dump(dc);
}
#endif //_DEBUG

/////////////////////////////////////////////////////////////////////////////
// CArithTest message handlers

void CArithTest::OnBeginTest() 
{
	// TODO: Add your control notification handler code here
	if(!theApp.testdb)
	{
		MessageBox("为了加快测试速度和测试的准确性,请进入到数据库管理窗口,然后在菜单中单击“创建特征库”");
		return;
	}
	long snum,wnum,anum;
	int ers,erw;
	ers=erw=0;
	snum=wnum=anum=0;
	FPTEST* test1,*test2;
	test1=theApp.testdb;
	int i,j,res;
	DWORD st,et;
	st = GetTickCount();
	for(i=0;i<theApp.num-1;i++)
	{
		test2=test1;
		test2++;
		for(j=i+1;j<theApp.num;j++)
		{
			res=FingerMatch(test1->minu,test2->minu,test1->centerx,test1->centery,test2->centerx,test2->centery);
			if((!strcmp(test1->name,test2->name))&&test1->fingerIndex==test2->fingerIndex)
			{
				snum++;
           	    if(res<theApp.m_nMatchDoor)
					ers++;
			}
			else
			{
				wnum++;
           	    if(res>=theApp.m_nMatchDoor)
					erw++;
			}
			test2++;
		}
		test1++;
	}
	et = GetTickCount();
	this->m_fAverTime=(float)(et-st)/(float)(snum+wnum);
	this->m_nAll_Num=snum+wnum;
	this->m_nShiBieNum=snum;
	this->m_nWuShiNum=wnum;
	this->m_fWuShiRe=(float)erw/(float)(snum+wnum);
	this->m_fShiBieRe=(float)ers/(float)(snum+wnum);
	m_nSampleSize = theApp.num ;

	FPTEST *tmp;
	if(theApp.testdb)
	{
		tmp=theApp.testdb;
		for(int i=0;i<theApp.num;i++)
		{
			if(tmp->quality==1)
				this->m_nSampleSizeA++;
			else if(tmp->quality==2)
				this->m_nSampleSizeB++;
			else
			    this->m_nSampleSizeC++;
			tmp++;
		}
	}

	UpdateData(false);


}
BOOL CArithTest::OnEraseBkgnd(CDC* pDC) 
{
	CRect rect;
	GetClientRect(&rect);
	for (int nX = 0; nX < rect.Width(); nX +=theApp.backbmp. m_Width-1)
		for (int nY = 0; nY < rect.Height(); nY +=theApp.backbmp. m_Height-1)
			theApp.backbmp.DrawDib(pDC,1,nX,nY);
	return TRUE;
}

HBRUSH CArithTest::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor) 
{
	HBRUSH hbr = CFormView::OnCtlColor(pDC, pWnd, nCtlColor);
	
	// TODO: Change any attributes of the DC here
		if(nCtlColor==CTLCOLOR_EDIT||nCtlColor==CTLCOLOR_LISTBOX)
		return hbr;
	else
	{
		pDC->SetBkMode(TRANSPARENT);
		pDC->SetTextColor(theApp.m_textcolor);
		return ((HBRUSH)::GetStockObject(HOLLOW_BRUSH));
	}

	// TODO: Return a different brush if the default is not desired
	return hbr;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -