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

📄 dialogtrackstyle.cpp

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

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

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

/////////////////////////////////////////////////////////////////////////////
// CDialogTrackStyle property page

IMPLEMENT_DYNCREATE(CDialogTrackStyle, CPropertyPage)

CDialogTrackStyle::CDialogTrackStyle() : CPropertyPage(CDialogTrackStyle::IDD)
{
	//{{AFX_DATA_INIT(CDialogTrackStyle)
	m_strEigenSapceFilePath = _T("");
	m_nEigenSpaceVectorNumber = 10;
	m_nTrackStyle = 2;
	//}}AFX_DATA_INIT
	m_conTrackType = TT_AFFINE;
}

CDialogTrackStyle::~CDialogTrackStyle()
{
}

void CDialogTrackStyle::DoDataExchange(CDataExchange* pDX)
{
	CPropertyPage::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CDialogTrackStyle)
	DDX_Text(pDX, IDC_EDIT_EIGENSPACE_FILEPATH, m_strEigenSapceFilePath);
	DDX_Text(pDX, IDC_EDIT_EIGENSPACE_VECTOR_NUMBER, m_nEigenSpaceVectorNumber);
	DDV_MinMaxInt(pDX, m_nEigenSpaceVectorNumber, 1, 2147483647);
	DDX_Radio(pDX, IDC_RADIO_KL, m_nTrackStyle);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CDialogTrackStyle, CPropertyPage)
	//{{AFX_MSG_MAP(CDialogTrackStyle)
	ON_BN_CLICKED(IDC_BUTTON_BROWSE, OnButtonBrowse)
	ON_EN_CHANGE(IDC_EDIT_EIGENSPACE_VECTOR_NUMBER, OnChangeEditEigenspaceVectorNumber)
	ON_BN_CLICKED(IDC_RADIO_KL, OnRadioKl)
	ON_BN_CLICKED(IDC_RADIO_SVD, OnRadioSvd)
	ON_BN_CLICKED(IDC_RADIO_AFFINE, OnRadioAffine)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CDialogTrackStyle message handlers

void CDialogTrackStyle::OnButtonBrowse() 
{
	this->UpdateData(true);
	CString szFilter;

	if(m_conTrackType == TT_KL_AFFINE)
		szFilter.Format("KL文件 (*.kl)|*.kl|");
	else if(m_conTrackType == TT_SVD_AFFINE)
		szFilter.Format("SVD文件 (*.voc)|*.voc|");

	CFileDialog dlg(TRUE,"voc||kl",NULL,OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT,szFilter);
	if(dlg.DoModal() == IDOK)
	{
		m_strEigenSapceFilePath = dlg.GetPathName();
	}
	this->UpdateData(FALSE);	
}

void CDialogTrackStyle::OnChangeEditEigenspaceVectorNumber() 
{
	this->UpdateData(true);
}
void CDialogTrackStyle::OnRadioKl() 
{
	m_nTrackStyle = 0;
	m_conTrackType = TT_KL_AFFINE;
	CWnd* pWnd = this->GetDlgItem(IDC_BUTTON_BROWSE);
	pWnd->EnableWindow(true);
	pWnd = this->GetDlgItem(IDC_EDIT_EIGENSPACE_FILEPATH);
	pWnd->EnableWindow(true);
	pWnd = this->GetDlgItem(IDC_EDIT_EIGENSPACE_VECTOR_NUMBER);
	pWnd->EnableWindow(true);
}
void CDialogTrackStyle::OnRadioSvd() 
{
	m_nTrackStyle = 1;
	m_conTrackType = TT_SVD_AFFINE;
	CWnd* pWnd = this->GetDlgItem(IDC_BUTTON_BROWSE);
	pWnd->EnableWindow(true);
	pWnd = this->GetDlgItem(IDC_EDIT_EIGENSPACE_FILEPATH);
	pWnd->EnableWindow(true);
	pWnd = this->GetDlgItem(IDC_EDIT_EIGENSPACE_VECTOR_NUMBER);
	pWnd->EnableWindow(true);
}
void CDialogTrackStyle::OnRadioAffine() 
{
	m_nTrackStyle = 2;
	m_conTrackType = TT_AFFINE;
	CWnd* pWnd = this->GetDlgItem(IDC_BUTTON_BROWSE);
	pWnd->EnableWindow(false);
	pWnd = this->GetDlgItem(IDC_EDIT_EIGENSPACE_FILEPATH);
	pWnd->EnableWindow(false);
	pWnd = this->GetDlgItem(IDC_EDIT_EIGENSPACE_VECTOR_NUMBER);
	pWnd->EnableWindow(false);
}

BOOL CDialogTrackStyle::OnInitDialog() 
{
	CPropertyPage::OnInitDialog();
	
    OnRadioAffine();
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

⌨️ 快捷键说明

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