数字识别view.h

来自「利用bp网络进行数字识别的示例程序」· C头文件 代码 · 共 95 行

H
95
字号
// 数字识别View.h : interface of the CMyView class
//
/////////////////////////////////////////////////////////////////////////////

#if !defined(AFX_VIEW_H__50362D53_080A_40F4_BA03_8F238B7AF137__INCLUDED_)
#define AFX_VIEW_H__50362D53_080A_40F4_BA03_8F238B7AF137__INCLUDED_

#if _MSC_VER > 1000
#pragma once

#endif // _MSC_VER > 1000
#define NN_NUMBERS	9	//包含的数的个数
#define NN_RESX		5	//X方向的长度
#define NN_RESY		7	//Y方向的长度
#define NN_NOISY	25	//噪声数据的数目
#define NN_MAXITER	500	//最大循环次数
#include "backprop.h"
class CMyView : public CView
{
protected: // create from serialization only
	CMyView();
	DECLARE_DYNCREATE(CMyView)

// Attributes
public:
	CMyDoc* GetDocument();

// Operations
public:

// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CMyView)
	public:
	virtual void OnDraw(CDC* pDC);  // overridden to draw this view
	virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
	protected:
	virtual BOOL OnPreparePrinting(CPrintInfo* pInfo);
	virtual void OnBeginPrinting(CDC* pDC, CPrintInfo* pInfo);
	virtual void OnEndPrinting(CDC* pDC, CPrintInfo* pInfo);
	//}}AFX_VIRTUAL

// Implementation
public:
	void SetTarget(double *t,double num);
	BPNN *net;
	void RunNet(BOOL training);
	BOOL draw;
	void DrawNumber(int *cell);
		//保存测试数据
	int		m_bTestData[NN_NUMBERS][NN_RESX * NN_RESY];
	//保存标准训练数据
	int		m_bNumbers[NN_NUMBERS][NN_RESX * NN_RESY];
	//保存在标准训练数据加上噪声后的数据
	int		m_iNoisy[NN_NUMBERS * NN_NOISY][NN_RESX * NN_RESY];
	//要画的数字
	int		*m_ipDrawNum;
	//要显示的字符串
	bool	m_bDisplayString;
	//网络的权值数组
	float	m_fWeights[NN_NUMBERS][NN_RESX * NN_RESY];
		CString m_Str;
	
	virtual ~CMyView();
#ifdef _DEBUG
	virtual void AssertValid() const;
	virtual void Dump(CDumpContext& dc) const;
#endif

protected:

// Generated message map functions
protected:
	//{{AFX_MSG(CMyView)
	afx_msg void OnInput();
	afx_msg void OnRandom();
	afx_msg void OnClassify();
	afx_msg void OnNoisy();
	afx_msg void OnRecog();
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
};

#ifndef _DEBUG  // debug version in 数字识别View.cpp
inline CMyDoc* CMyView::GetDocument()
   { return (CMyDoc*)m_pDocument; }
#endif

/////////////////////////////////////////////////////////////////////////////

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_VIEW_H__50362D53_080A_40F4_BA03_8F238B7AF137__INCLUDED_)

⌨️ 快捷键说明

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