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

📄 dialogtemplateupdate.cpp

📁 利用web camera对目标进行特征跟踪的程序 对于初学机器视觉的有些帮助
💻 CPP
字号:
// DialogTemplateUpdate.cpp : implementation file
//

#include "stdafx.h"
#include "图像特征跟踪系统.h"
#include "DialogTemplateUpdate.h"

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

/////////////////////////////////////////////////////////////////////////////
// CDialogTemplateUpdate property page

IMPLEMENT_DYNCREATE(CDialogTemplateUpdate, CPropertyPage)

CDialogTemplateUpdate::CDialogTemplateUpdate() : CPropertyPage(CDialogTemplateUpdate::IDD)
{
	//{{AFX_DATA_INIT(CDialogTemplateUpdate)
	m_nTemplateUpdateType = 0;
	//}}AFX_DATA_INIT
	m_conTemplateUpdateType = TTUT_PWOER;
	m_nPowerResult = 0;
	CheckButtonID = new UINT[4];
	CheckButtonID[0] = IDC_RADIO_POWER;
	CheckButtonID[1] = IDC_RADIO_MOVING_TARGET_SEGMENT;
	CheckButtonID[2] = IDC_RADIO_EIGENSPACE_TRAINOFFLIEN;
	CheckButtonID[3] = IDC_RADIO_EIGENSPACE_TRAINONLINE;
}

CDialogTemplateUpdate::~CDialogTemplateUpdate()
{
	delete CheckButtonID;
}

void CDialogTemplateUpdate::DoDataExchange(CDataExchange* pDX)
{
	CPropertyPage::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CDialogTemplateUpdate)
	DDX_Control(pDX, IDC_COMBO_UPDATE_POWER, m_conUpdatePower);
	DDX_Radio(pDX, IDC_RADIO_POWER, m_nTemplateUpdateType);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CDialogTemplateUpdate, CPropertyPage)
	//{{AFX_MSG_MAP(CDialogTemplateUpdate)
	ON_BN_CLICKED(IDC_RADIO_POWER, OnRadioPower)
	ON_BN_CLICKED(IDC_RADIO_MOVING_TARGET_SEGMENT, OnRadioMovingTargetSegment)
	ON_BN_CLICKED(IDC_RADIO_EIGENSPACE_TRAINOFFLIEN, OnRadioEigenspaceTrainofflien)
	ON_BN_CLICKED(IDC_RADIO_EIGENSPACE_TRAINONLINE, OnRadioEigenspaceTrainonline)
	ON_CBN_SELENDOK(IDC_COMBO_UPDATE_POWER, OnSelendokComboUpdatePower)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CDialogTemplateUpdate message handlers

void CDialogTemplateUpdate::SetCheckButton(int id)
{
	CButton* pButton=NULL;
	for(int i=0;i<4;i++)
	{
		pButton = (CButton*) this->GetDlgItem(CheckButtonID[i]);
		if(i!=id)
			pButton->SetCheck(false);
		else 
			pButton->SetCheck(true);
	}

	CWnd* pWnd = this->GetDlgItem(IDC_COMBO_UPDATE_POWER);
	if(pWnd) 
	{
		if(id>=2)
			pWnd->EnableWindow(false);
		else
			pWnd->EnableWindow(true);
	}
		
	UpdateWindow();
}

void CDialogTemplateUpdate::OnRadioPower() 
{
	m_nTemplateUpdateType=0;
	m_conTemplateUpdateType = TTUT_PWOER;
	SetCheckButton(m_nTemplateUpdateType);
}
void CDialogTemplateUpdate::OnRadioMovingTargetSegment() 
{
	m_nTemplateUpdateType=1;
	m_conTemplateUpdateType = TTUT_MOVING_TARGET_SEGMENT;
	SetCheckButton(m_nTemplateUpdateType);
}
void CDialogTemplateUpdate::OnRadioEigenspaceTrainofflien() 
{
	m_nTemplateUpdateType=2;
	m_conTemplateUpdateType = TTUT_EIGENSPACE_TRAINNING_OFFLINE;
	SetCheckButton(m_nTemplateUpdateType);
}
void CDialogTemplateUpdate::OnRadioEigenspaceTrainonline() 
{
	m_nTemplateUpdateType=3;
	m_conTemplateUpdateType = TTUT_EIGENSPACE_TRAINNING_ONLINE;
	SetCheckButton(m_nTemplateUpdateType);
}

BOOL CDialogTemplateUpdate::OnInitDialog() 
{
	CPropertyPage::OnInitDialog();
	
	m_conUpdatePower.AddString("1:0");
	m_conUpdatePower.AddString("1:2");
	m_conUpdatePower.AddString("1:4");
	m_conUpdatePower.AddString("1:8");
	m_conUpdatePower.AddString("0:1");
	m_conUpdatePower.SetCurSel(0);
	m_conUpdatePower.UpdateWindow();

	m_nTemplateUpdateType = 0;
	m_conTemplateUpdateType = TTUT_PWOER;
	SetCheckButton(m_nTemplateUpdateType);

	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

void CDialogTemplateUpdate::OnSelendokComboUpdatePower() 
{
	int i = m_conUpdatePower.GetCurSel();
	switch (i)
	{
		case 0: m_nPowerResult = 0;		break;
		case 1: m_nPowerResult = 1;		break;
		case 2: m_nPowerResult = 0.5;	break;
		case 3: m_nPowerResult = 0.25;	break;
		case 4: m_nPowerResult = 0.125;	break;
		default:
			AfxMessageBox("Wrong selection!");
	}
}

⌨️ 快捷键说明

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