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

📄 dipview.h

📁 汽车牌照智能识别C++源程序代码
💻 H
字号:
// dipView.h : interface of the CDipView class
//
/////////////////////////////////////////////////////////////////////////////

#if !defined(AFX_DIPVIEW_H__C986E395_5D00_49E6_8CC4_C66489A44EC0__INCLUDED_)
#define AFX_DIPVIEW_H__C986E395_5D00_49E6_8CC4_C66489A44EC0__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include "Mdlg.h"
#include "digitclass.h"
#include "AnnBP.h"	// Added by ClassView
#include "Training.h"	// Added by ClassView


class CDipView : public CView
{
//data
public:
	int a;
	int b;
	CBitmap* m_pBmp;
	CDC  * m_pMemDC;				//内存DC
	CBitmap  * m_pBitmap,*mymap;	//背景图像,当前数据的内存图像
	bool IsNewFile,IsNewBitmap;		//数据是否更新,内存图像是否更新
	CList <sample,sample> hanList;
	CList <sample,sample> charList;
	CList <sample,sample> numList;
	
protected: // create from serialization only
	CDipView();
	DECLARE_DYNCREATE(CDipView)

// Attributes
public:
	CDipDoc* GetDocument();

// Operations
public:

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

// Implementation
public:
	BYTE* img;
	
	void ChageStatuBar(char * fmt);
	virtual ~CDipView();
#ifdef _DEBUG
	virtual void AssertValid() const;
	virtual void Dump(CDumpContext& dc) const;
#endif

protected:

// Generated message map functions
protected:
	//{{AFX_MSG(CDipView)
	afx_msg void OnFileOpen();
	afx_msg void OnPaint();
	afx_msg void OnFileSave();
	afx_msg void Onreopen();
	afx_msg void OnMouseMove(UINT nFlags, CPoint point);
	afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
	afx_msg void OnLine();
	afx_msg void Onrhua();
	afx_msg void Onphua();
	afx_msg void Onfse();
	afx_msg void Onfz();
	afx_msg void OnMoHu();
	afx_msg void OnSuoXiao();
	afx_msg void OnForHandle();
	afx_msg void OnHSearch();
	afx_msg void OnBanlance();
	afx_msg void OnSubVertical();
	afx_msg void OnSubHorizontal();
	afx_msg void OnMidValue();
	afx_msg void OnAverage();
	afx_msg void OnBool();
	afx_msg void OnChoose();
	afx_msg void OnTrainfromvehicle();
	afx_msg void OnSave();
	afx_msg void OnLoad();
	afx_msg void OnChange();
	afx_msg void OnTrain();
	afx_msg void OnSavebp();
	afx_msg void OnReadbp();
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
public:
	CTraining* m_pdlg;
	CAnnBP char_num_bp;
	CAnnBP num_bp;
	CAnnBP char_bp;
	POSITION char_ConnectPos;
	POSITION num_ConnectPos;
	POSITION han_ConnectPos;
	//分割出的字符数
	int CharacterNum;
	void ForHandle(BYTE* DisposeImg,int width,int height);
	void VFurthLocate(BYTE* DisposeImg,int width,int height);
	// 精确定位
	void FurtherLocate(CDipDoc *DisposeImg,int width,int height);
	int MaxJump(int *JumpNums,int num);
	// 计算各伪车牌区的跳变数
	int JumpNum(BYTE*DisposeImg,int width,int height);
	// 去伪存真
	void Choose(CDipDoc *DisposeImg,int width,int height);
	afx_msg void OnVSearch();
	afx_msg void OnLocate();
	// 均衡化图象
	void Banlance(BYTE* DisposeImg,int Width,int Height);
	// 图象复制
	void CopyImg(CDipDoc *SourceImg, BYTE* DestImg, int Width, int Height);
	// 水平差分
	void HSub(BYTE* DisposeImg, int Width , int Height);
	// 选择区域的高度
	int* Height;
	// 选择区域的起始行
	int* TopRow;
	// 完成图象车牌区域的定位
	void Search(BYTE* DisposeImg, int width , int height);
	// 图象复制
	void CopyImg(BYTE* SourceImg, BYTE* DestImg, int Width , int Height);
	// 标识车牌区域	
	void Mark(CDipDoc * DisposeImg, int width , int height);
	void VSearch(BYTE* DisposeImg, int width, int height);
	// 车牌宽度区域值
	int* Widths;
	// 车牌左边缘
	int* Left;
	// 纵向差分
	void VSub(BYTE* DisposeImg, int Width , int Height);
	// 纵向定位
	void VMark(CDipDoc* DisposeImg, int width, int height);	
	// 起始位置的横坐标
	int* Rect_X;
	// 纵坐标
	int* Rect_Y;
	// 宽度
	int* Rect_W;
	// 高度
	int* Rect_H;
	// 伪车牌区域
	void DrawRect(CDipDoc* DisposeImg, int width, int height);
	// 可能的区域数
	int Rect_Areas;
	// 寻找left==255,right==0的列
	int FindNextCol_LR(int* HProj, int size, int objectCol);
	// 寻找right==255,left==0的列
	int FindNextCol_RL(int* HProj, int size, int objectCol);
	afx_msg void OnSobel();
	afx_msg void OnVSplit();        
	// 图像规定化0~100
	void GuiYiHua(BYTE* DisposeImg, int width , int height);
	// 增强车牌区,削弱背景
	void Hance(BYTE* DisposeImg, int width , int height);
	afx_msg void OnGuiYiHua();
	afx_msg void OnHance();
	// 分割出字符
	void HProj(BYTE* DisposeImg, int* projArray, int width , int height);
	// 寻找波谷
	void FindTrough(int* Array, int size);
	//剔除部分边框
	//void DropLine(BYTE* DisposeImg, int width,int height);
	// 精确定位各字符域
	void FindCharacter(BYTE* DisposeImg, int width , int height ,int*Array, int size);
	//车牌区域再次定位
	void VSearchAdvance(BYTE* DisposeImg, int width, int height,int lside);
	// 分割字符
	void CharacterSplit(int* Array, int size);
	
	//字符区域的矩形表示(相对与原始图象)
	struct cRect
	{
		int x;
		int y;
		int w;
		int h;
	};
	typedef cRect crect;
	crect *cRects;

	//字符区域的实际数据保存
	struct characetrData
	{
		BYTE* Img;
		int w;
		int h;
	};
	typedef characetrData cData;
	cData *cDatas;

	struct sample//保存样本的结构体
	{
		double feature[13];//样本的特征向量
		char trueClass[3];//样本所属的真实类别+
		int serialnum;//序列号
	};

	int CDipView::map(char *character);
/*	// //读取样本库,传入一个sample类型的数组(从文件里读出的样本数据将放入其中),返回值为样本个数
	int LoadCharLib(sample* sa);
	// 缩放算法,一律缩放为20*36
	void Zoom(BYTE* DisposeImg, int width, int height);
	// 二值化算法,二值化为0和1两种值
	void BinaryImg(BYTE* DisposeImg, int width , int height);
	// Hilditch细化算法
	void ThinnerHilditch(void*image, unsigned long lx, unsigned long ly);
	// 细化算法
	void ThinImage(BYTE* image, int width, int height);
	// 获取特征值的函数
	void GetFeature(BYTE* image, long width, long height, double* feature, int size);
	// 识别函数,第一个参数为LoadCharLib读出的数组,第二个参数为LoadCharLib的返回值(即样本个数),将上面获得的特征值传入第三个参数,返回为识别结果
	CString Recognize(sample* sa, int num, double* feature);
	// 字符识别
	void GetCharacter();*/
	afx_msg void OnCharacterRecg();
};

#ifndef _DEBUG  // debug version in dipView.cpp
inline CDipDoc* CDipView::GetDocument()
   { return (CDipDoc*)m_pDocument; }
#endif

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

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

#endif // !defined(AFX_DIPVIEW_H__C986E395_5D00_49E6_8CC4_C66489A44EC0__INCLUDED_)

⌨️ 快捷键说明

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