车牌识别VC++,包括定位和汉字识别
/////////////////////////////////////////////////////////////////////////////
// CPatternDlg message handlers
BOOL CPatternDlg::OnInitDialog()
{
CFile cf;
CDialog::OnInitDialog();
mouseDown=0;
int i,j,k;
//将每个笔划上坐标初始化为空
for(i=0;i<15;i++)
{
for(j=0;j<300;j++)
{
store[i][j].x=-1;
store[i][j].y=-1;
}
}
for(i=0;i<15;i++)
{
for(j=0;j<300;j++)
{
storeback[i][j].x=-1;
storeback[i][j].y=-1;
}
}
for(i=0;i<10;i++)
{
tez[i].total=-1;
for(j=0;j<15;j++)
tez[i].dian[j]=-1;
for(j=0;j<15;j++)
{
for(k=0;k<20;k++)
{
tez[i].detail[j][k].relate=0;
tez[i].detail[j][k].arc=0;
tez[i].detail[j][k].region=0;
}
}
}
Time=0;
num=0;
zong=-1;//tez下标
xmax=0;
ymax=0;
xmin=31;
ymin=31;
for(i=0;i<50;i++)
queue[i]=-1;
for(i=0;i<40;i++)
queue1[i]=-1;
test.total=-1;
for(j=0;j<15;j++)
test.dian[j]=-1;
for(j=0;j<15;j++)
{
for(k=0;k<20;k++)
{
test.detail[j][k].relate=0;
test.detail[j][k].arc=0;
test.detail[j][k].region=0;
}
}
// Add "About..." menu item to system menu.
// IDM_ABOUTBOX must be in the system command range.
ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
ASSERT(IDM_ABOUTBOX < 0xF000);
CMenu* pSysMenu = GetSystemMenu(FALSE);
if (pSysMenu != NULL)
{
CString strAboutMenu;
strAboutMenu.LoadString(IDS_ABOUTBOX);
if (!strAboutMenu.IsEmpty())
{
pSysMenu->AppendMenu(MF_SEPARATOR);
pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
}
}
// Set the icon for this dialog. The framework does this automatically
// when the application's main window is not a dialog
SetIcon(m_hIcon, TRUE); // Set big icon
SetIcon(m_hIcon, FALSE); // Set small icon
// TODO: Add extra initialization here
if(cf.Open("mydata.dat",CFile::modeCreate|CFile::modeNoTruncate|CFile::modeReadWrite)==NULL){
AfxMessageBox("打开文件失败,\n您最好退出程序");}
return TRUE; // return TRUE unless you set the focus to a control
}
void CPatternDlg::OnSysCommand(UINT nID, LPARAM lParam)
{
if ((nID & 0xFFF0) == IDM_ABOUTBOX)
{
CAboutDlg dlgAbout;
dlgAbout.DoModal();
}
else
{
CDialog::OnSysCommand(nID, lParam);
}
}
// If you add a minimize button to your dialog, you will need the code below
// to draw the icon. For MFC applications using the document/view model,
// this is automatically done for you by the framework.
void CPatternDlg::OnPaint()
{
CPaintDC dc(this);
HBRUSH hB;
hB=CreateSolidBrush(RGB(255,255,255));
SelectObject(dc,hB);
Rectangle(dc,Startx,Starty,Startx+wid-1,Starty+lon-1);
DeleteObject(hB);
if (IsIconic())
{
// device context for painting
SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);
// Center icon in client rectangle
int cxIcon = GetSystemMetrics(SM_CXICON);
int cyIcon = GetSystemMetrics(SM_CYICON);
CRect rect;
GetClientRect(&rect);
int x = (rect.Width() - cxIcon + 1) / 2;
int y = (rect.Height() - cyIcon + 1) / 2;
// Draw the icon
dc.DrawIcon(x, y, m_hIcon);
}
else
{
CDialog::OnPaint();
}
}
// The system calls this to obtain the cursor to display while the user drags
// the minimized window.