📄 数字识别view.h
字号:
// 数字识别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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -