📄 detectandtrackdlg.h
字号:
// DetectAndTrackDlg.h : header file
//
#if !defined(AFX_DETECTANDTRACKDLG_H__7E120455_D38C_4401_B4B8_3E35C997D318__INCLUDED_)
#define AFX_DETECTANDTRACKDLG_H__7E120455_D38C_4401_B4B8_3E35C997D318__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
/////////////////////////////////////////////////////////////////////////////
// CDetectAndTrackDlg dialog
#include "ImageWnd.h"
#include "Group.h"
#include <vector>
using namespace std;
class CDetectAndTrackDlg : public CDialog
{
// Construction
public:
CDetectAndTrackDlg(CWnd* pParent = NULL); // standard constructor
//图像打开辅助函数
public:
void LoadBitmap(); //载入位图
void PutPoints(int nWidth,int nHeight,BYTE *pbtBits,BYTE *pbtPoints); //获取图像数据
void GetPoints(int nWidth,int nHeight,BYTE *pbtBits,BYTE *pbtPoints); //输出图像数据
//图像处理所需数据
public:
int m_nWidth,m_nHeight; //图像宽、高
int m_nLen; //图像数据长度
int m_nByteWidth; //图像字节数
BYTE *m_pbtBackup; //背景图像(子窗口)
BYTE *m_pbtBitmap; //图像所有数据
BYTE *m_pbtBits; //图像像素数据
BYTE *m_pbtBitsOfBackGround; //背景图像像素数据
BYTE *m_pbtBitsOfDetect; //待检测图像像素数据
BYTE *m_pbtBitsOfDifference; //差分后图像像素数据
CString m_strFileName; //文件名,用于打开图像
int m_nLimit; //背景差分阈值
//子窗口,用来显示背景图片、待检测图片和差分图片
CImageWnd m_IWBackGround,m_IWDetect,m_IWDifference;
//C均值算法辅助函数
public:
void FilterPoints(); //筛选出像素值为255的像素点
float Distance(CPixelPoint &p1,CPixelPoint &p2); //两像素点间距离
void InitCenter(); //初始化聚类中心
void Allocate(); //对像素点进行聚类
void ReviseCenter(); //修正聚类中心
void ChangeCenter(); //更改聚类中心
float Distance(); //聚类中心间距离
//C均值算法变量
public:
BOOL IsCloserCenter();
vector<CPixelPoint> m_VectorOfPoints; //像素点
vector<CGroup> m_VectorOfGroup; //聚类信息
unsigned int m_nCountOfGroup; //聚类数目
// Dialog Data
//{{AFX_DATA(CDetectAndTrackDlg)
enum { IDD = IDD_DETECTANDTRACK_DIALOG };
CString m_strGroupResult; //聚类结果
int m_nCountOfObjects; //目标数目
//}}AFX_DATA
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CDetectAndTrackDlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
HICON m_hIcon;
// Generated message map functions
//{{AFX_MSG(CDetectAndTrackDlg)
virtual BOOL OnInitDialog();
afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
afx_msg void OnPaint();
afx_msg HCURSOR OnQueryDragIcon();
virtual void OnOK();
virtual void OnCancel();
afx_msg void OnOpenBackground();
afx_msg void OnOpenDetect();
afx_msg void OnExit();
afx_msg void OnDoDifference();
afx_msg void OnAbout();
afx_msg void OnCountObjects();
afx_msg void OnPretreatmentDilate();
afx_msg void OnPretreatmentErodt();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_DETECTANDTRACKDLG_H__7E120455_D38C_4401_B4B8_3E35C997D318__INCLUDED_)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -