- 浏览: 1111930 次
文章分类
最新评论
-
cuityang:
有没有 tts 语音合成的例子?请站内我 3q
一个Nuance 的语音识别的例子 -
cipherlab:
请教一个问题,sapi : tts 到 内存buff中(wav ...
基于Windows Sdk 与visual C++2008 在微软平台上构架自己的语音朗读引擎(适用于windows 2000/xp2003/vista windows CE /mobile),本项目开源,源码请留下你们的Email,我给大家发 -
cipherlab:
请教一个问题,如何之际 sapi tts 到 内存buff中 ...
基于Windows Sdk 与visual C++2008 在微软平台上构架自己的语音朗读引擎(适用于windows 2000/xp2003/vista windows CE /mobile),本项目开源,源码请留下你们的Email,我给大家发 -
cipherlab:
嗨,你好,哥们!
基于Windows Sdk 与visual C++2008 在微软平台上构架自己的语音朗读引擎(适用于windows 2000/xp2003/vista windows CE /mobile),本项目开源,源码请留下你们的Email,我给大家发 -
zsslxy2006:
565242785@qq.com
感谢!才人哪
年少痴狂,怀恋曾经的创业岁月,语音识别的应用远远未到高潮,本人的软件源码开源,需要的留下Email,我给大家发
识别简单的数字,字母的手写识别框架
- //patternDlg.cpp:implementationfile
- //
- #include"stdafx.h"
- #include"pattern.h"
- #include"patternDlg.h"
- #include"Afxwin.h"
- #include"Afxdlgs.h"
- #include"winuser.h"
- #include"Store.h"
- #include<STDIO.H>
- //#define_MBCS
- #ifdef_DEBUG
- #definenewDEBUG_NEW
- #undefTHIS_FILE
- staticcharTHIS_FILE[]=__FILE__;
- #endif
- #include<WINDOWS.H>
- #include<MATH.H>
- #defineStartx30
- #defineStarty190
- #definewid192
- #definelon192
- #defineyu3//2area
- #defineyu15//doudong
- #defineyu24
- intnum,Time;
- intxmax,ymax,xmin,ymin;//随时纪录书写过程中的书写范围
- //存储书写笔迹的坐标序列,按笔划存储,每个笔划最多300个点
- //每个字最多15个笔划
- struct
- {
- intx;
- inty;
- }store[15][300];
- //备份的序列
- struct
- {
- intx;
- inty;
- }storeback[15][300];
- struct
- {
- inttotal;//总的笔划数
- charzifu[2];//代表字符
- intdian[15];//每个笔划的点数
- struct{
- intrelate;//相对前点特征
- intregion;//全局位置特征
- intarc;//过渡带特征
- }detail[15][20];//15个笔划上的特征点,每个笔划20个特征点
- }tez[2002];
- struct
- {
- inttotal;
- intdian[15];
- struct
- {
- intrelate;
- intregion;
- intarc;
- }detail[15][20];
- }test;//意义同上,为测试点的结构
- intqueue[50];
- intqueue1[40];
- intzong;
- /////////////////////////////////////////////////////////////////////////////
- //CAboutDlgdialogusedforAppAbout
- classCAboutDlg:publicCDialog
- {
- public:
- CAboutDlg();
- //DialogData
- //{{AFX_DATA(CAboutDlg)
- enum{IDD=IDD_ABOUTBOX};
- //}}AFX_DATA
- //ClassWizardgeneratedvirtualfunctionoverrides
- //{{AFX_VIRTUAL(CAboutDlg)
- protected:
- virtualvoidDoDataExchange(CDataExchange*pDX);//DDX/DDVsupport
- //}}AFX_VIRTUAL
- //Implementation
- protected:
- //{{AFX_MSG(CAboutDlg)
- //}}AFX_MSG
- DECLARE_MESSAGE_MAP()
- };
- CAboutDlg::CAboutDlg():CDialog(CAboutDlg::IDD)
- {
- //{{AFX_DATA_INIT(CAboutDlg)
- //}}AFX_DATA_INIT
- }
- voidCAboutDlg::DoDataExchange(CDataExchange*pDX)
- {
- CDialog::DoDataExchange(pDX);
- //{{AFX_DATA_MAP(CAboutDlg)
- //}}AFX_DATA_MAP
- }
- BEGIN_MESSAGE_MAP(CAboutDlg,CDialog)
- //{{AFX_MSG_MAP(CAboutDlg)
- //Nomessagehandlers
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
- /////////////////////////////////////////////////////////////////////////////
- //CPatternDlgdialog
- CPatternDlg::CPatternDlg(CWnd*pParent/*=NULL*/)
- :CDialog(CPatternDlg::IDD,pParent)
- {
- //{{AFX_DATA_INIT(CPatternDlg)
- //}}AFX_DATA_INIT
- //NotethatLoadIcondoesnotrequireasubsequentDestroyIconinWin32
- m_hIcon=AfxGetApp()->LoadIcon(IDR_MAINFRAME);
- }
- voidCPatternDlg::DoDataExchange(CDataExchange*pDX)
- {
- CDialog::DoDataExchange(pDX);
- //{{AFX_DATA_MAP(CPatternDlg)
- DDX_Control(pDX,IDC_EDIT2,m_edit2);
- DDX_Control(pDX,IDC_EDIT1,m_edit1);
- DDX_Control(pDX,IDC_BUTTON4,m_escape);
- DDX_Control(pDX,IDC_BUTTON3,m_clear);
- DDX_Control(pDX,IDC_BUTTON1,m_recog);
- DDX_Control(pDX,IDC_BUTTON2,m_study);
- //}}AFX_DATA_MAP
- }
- BEGIN_MESSAGE_MAP(CPatternDlg,CDialog)
- //{{AFX_MSG_MAP(CPatternDlg)
- ON_WM_SYSCOMMAND()
- ON_WM_PAINT()
- ON_WM_QUERYDRAGICON()
- ON_BN_CLICKED(IDC_BUTTON4,OnEsp)
- ON_BN_CLICKED(IDC_BUTTON1,OnRecog)
- ON_WM_MOUSEMOVE()
- ON_BN_CLICKED(IDC_BUTTON3,OnClear)
- ON_BN_CLICKED(IDC_BUTTON2,OnStudy)
- ON_WM_LBUTTONUP()
- ON_WM_LBUTTONDOWN()
- ON_COMMAND(ID_EXIT_MENU,OnExitMenu)
- ON_COMMAND(ID_ABOUT_MENU,OnAboutMenu)
- ON_COMMAND(ID_SAVE_MENU,OnSaveMenu1)
- ON_COMMAND(ID_OPEN_MENU,OnOpenMenu)
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
- /////////////////////////////////////////////////////////////////////////////
- //CPatternDlgmessagehandlers
- BOOLCPatternDlg::OnInitDialog()
- {
- CFilecf;
- CDialog::OnInitDialog();
- mouseDown=0;
- inti,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..."menuitemtosystemmenu.
- //IDM_ABOUTBOXmustbeinthesystemcommandrange.
- ASSERT((IDM_ABOUTBOX&0xFFF0)==IDM_ABOUTBOX);
- ASSERT(IDM_ABOUTBOX<0xF000);
- CMenu*pSysMenu=GetSystemMenu(FALSE);
- if(pSysMenu!=NULL)
- {
- CStringstrAboutMenu;
- strAboutMenu.LoadString(IDS_ABOUTBOX);
- if(!strAboutMenu.IsEmpty())
- {
- pSysMenu->AppendMenu(MF_SEPARATOR);
- pSysMenu->AppendMenu(MF_STRING,IDM_ABOUTBOX,strAboutMenu);
- }
- }
- //Settheiconforthisdialog.Theframeworkdoesthisautomatically
- //whentheapplication'smainwindowisnotadialog
- SetIcon(m_hIcon,TRUE);//Setbigicon
- SetIcon(m_hIcon,FALSE);//Setsmallicon
- //TODO:Addextrainitializationhere
- if(cf.Open("mydata.dat",CFile::modeCreate|CFile::modeNoTruncate|CFile::modeReadWrite)==NULL){
- AfxMessageBox("打开文件失败,/n您最好退出程序");}
- returnTRUE;//returnTRUEunlessyousetthefocustoacontrol
- }
- voidCPatternDlg::OnSysCommand(UINTnID,LPARAMlParam)
- {
- if((nID&0xFFF0)==IDM_ABOUTBOX)
- {
- CAboutDlgdlgAbout;
- dlgAbout.DoModal();
- }
- else
- {
- CDialog::OnSysCommand(nID,lParam);
- }
- }
- //Ifyouaddaminimizebuttontoyourdialog,youwillneedthecodebelow
- //todrawtheicon.ForMFCapplicationsusingthedocument/viewmodel,
- //thisisautomaticallydoneforyoubytheframework.
- voidCPatternDlg::OnPaint()
- {
- CPaintDCdc(this);
- HBRUSHhB;
- hB=CreateSolidBrush(RGB(255,255,255));
- SelectObject(dc,hB);
- Rectangle(dc,Startx,Starty,Startx+wid-1,Starty+lon-1);
- DeleteObject(hB);
- if(IsIconic())
- {
- //devicecontextforpainting
- SendMessage(WM_ICONERASEBKGND,(WPARAM)dc.GetSafeHdc(),0);
- //Centericoninclientrectangle
- intcxIcon=GetSystemMetrics(SM_CXICON);
- intcyIcon=GetSystemMetrics(SM_CYICON);
- CRectrect;
- GetClientRect(&rect);
- intx=(rect.Width()-cxIcon+1)/2;
- inty=(rect.Height()-cyIcon+1)/2;
- //Drawtheicon
- dc.DrawIcon(x,y,m_hIcon);
- }
- else
- {
- CDialog::OnPaint();
- }
- }
- //Thesystemcallsthistoobtainthecursortodisplaywhiletheuserdrags
- //theminimizedwindow.
- HCURSORCPatternDlg::OnQueryDragIcon()
- {
- return(HCURSOR)m_hIcon;
- }
- voidCPatternDlg::OnEsp()
- {
- OnOK();
- }
- //识别函数
- voidCPatternDlg::OnRecog()
- {
- intj1,k1,m1,n1,x,y,xmod,ymod;//xmod,ymod;
- intflagok2=0;
- chars[20];
- DealData();
- //安次序检验,有点下标数
- for(j1=0;j1<=zong&&test.total>=0&&flagok2==0;j1++)
- {
- if(tez[j1].total==test.total)//如果总条数相等
- {
- for(k1=0;k1<=test.total;k1++)
- {
- if(test.dian[k1]!=tez[j1].dian[k1])
- break;
- }
- if(k1>test.total)
- //每条得点数相同
- {
- for(m1=0;m1<=test.total;m1++)//每条
- {
- for(n1=0;n1<=test.dian[m1];n1++)//每点
- {
- xmod=2*(tez[j1].detail[m1][n1].region%8);//8等分
- ymod=2*((int)tez[j1].detail[m1][n1].region/8);
- x=test.detail[m1][n1].region%16;
- y=(int)test.detail[m1][n1].region/16;//5/16
- if((test.detail[m1][n1].relate!=tez[j1].detail[m1][n1].relate
- &&(test.detail[m1][n1].relate-10*(int)(test.detail[m1][n1].relate/10))!=tez[j1].detail[m1][n1].relate
- &&(int)(test.detail[m1][n1].relate/10)!=tez[j1].detail[m1][n1].relate)
- ||((tez[j1].detail[m1][n1].arc!=test.detail[m1][n1].arc)&&(test.total<4)&&(test.dian[m1]<4))
- ||((x<XMOD-3||X>xmod+3)||(y<YMOD-3||Y>ymod+3)))//shi为total+1
- break;
- }
- if(n1<=test.dian[m1])
- break;
- }
- if(m1>test.total)
- {
- flagok2=1;
- sprintf(s,"输入正确,可识别,为:%s,在字库%d个",tez[j1].zifu,j1);
- AfxMessageBox(s);
- m_edit1.ReplaceSel(tez[j1].zifu);
- OnClear();
- }
- }
- }
- }
- if(flagok2==0)
- {
- AfxMessageBox("字库不足或输入不规范,无法识别,请学习");
- OnRecogch();
- }
- }
- //学习函数
- voidCPatternDlg::OnStudy()
- {
- intj1,k1,m1,n1,k,m,xmod,ymod,x,y;//j1代表字典中的一个字,k表示笔划,m表示一个点
- CStringz1;
- inti,j;
- intflagok1=0;//o无法识别,1可识别,已经识别出结果
- chars[30];
- Inputdialoginputdlg;
- //处理数据
- DealData();
- if(test.total==-1)
- {
- AfxMessageBox("没有笔迹输入,/n请重示");
- }
- for(j1=0;j1<=zong&&test.total!=-1;j1++)
- {
- if(flagok1==1)
- break;
- if(tez[j1].total==test.total&&flagok1==0)//总笔划相等
- {
- for(k1=0;k1<=test.total;k1++)
- {
- if(test.dian[k1]!=tez[j1].dian[k1])
- break;
- }
- if(k1>test.total)//每笔划点数相同下
- {
- for(m1=0;m1<=test.total;m1++)
- {
- for(n1=0;n1<=test.dian[m1];n1++)
- {
- if((test.detail[m1][n1].relate!=tez[j1].detail[m1][n1].relate
- &&(test.detail[m1][n1].relate%10)!=tez[j1].detail[m1][n1].relate
- &&((int)(test.detail[m1][n1].relate/10))!=tez[j1].detail[m1][n1].relate)
- ||(tez[j1].detail[m1][n1].arc!=test.detail[m1][n1].arc))//shi为total+1
- break;
- xmod=2*(tez[j1].detail[m1][n1].region%8);//8等分
- ymod=2*((int)tez[j1].detail[m1][n1].region/8);
- x=test.detail[m1][n1].region%16;
- y=(int)test.detail[m1][n1].region/16;
- if((x<XMOD-1||X>xmod+1)||(y<YMOD-1||Y>ymod+1))
- break;//3/16
- }//对一个笔划的判断,tezheng不等,跳出n
- if(n1<=test.dian[m1])
- break;//cibihua不等,跳出m循环
- }
- if(m1>test.total&&k1>test.total)//当前库字与输入相符合
- {
- flagok1=1;
- sprintf(s,"您输入的是:%s,数据已有",tez[j1].zifu);
- AfxMessageBox(s);
- m_edit1.ReplaceSel(tez[j1].zifu);
- OnClear();
- }
- }
- }
- }
- if(flagok1==0&&test.total>=0&&inputdlg.DoModal()==IDOK)//shuruzifu
- {
- if(inputdlg.m_input1!=inputdlg.m_input2
- ||inputdlg.m_input1==""||inputdlg.m_input1=="")
- {
- AfxMessageBox("您的输入有误(不等或空格),/n请重新输入");
- 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].region=0;
- }
- }
- }
- else
- {
- zong++;
- sprintf(tez[zong].zifu,"%s",inputdlg.m_input1);
- tez[zong].total=test.total;
- for(i=0;i<=test.total;i++)
- {
- tez[zong].dian[i]=test.dian[i];
- for(j=0;j<=test.dian[i];j++)
- {
- tez[zong].detail[i][j].relate=(test.detail[i][j].relate%10);
- tez[zong].detail[i][j].arc=test.detail[i][j].arc;
- x=(int)(test.detail[i][j].region%16)/2;
- y=(int)(test.detail[i][j].region/16)/2;
- tez[zong].detail[i][j].region=8*y+x;
- }
- }
- OnSaveMenu();
- if(zong>=2000)
- AfxMessageBox("版本太低,容量受限,Sorry!");
- m_edit1.ReplaceSel(inputdlg.m_input1);
- OnClear();
- }//zongdang前库下标
- }
- }
- voidCPatternDlg::OnLButtonDown(UINTnFlags,CPointpoint)
- {
- mouseDown=1;
- CWnd::OnLButtonDown(nFlags,point);
- }
- //鼠标左键抬起
- voidCPatternDlg::OnLButtonUp(UINTnFlags,CPointpoint)
- {
- mouseDown=0;
- if(store[num][Time-1].x>=0&&Time>0)
- {
- num++;
- Time=0;
- }
- if(num>=14)
- {
- AfxMessageBox("写入有误(笔划太多)",NULL,NULL);
- OnClear();
- }
- CWnd::OnLButtonUp(nFlags,point);
- }
- //鼠标移动事件,模拟手写笔输入
- voidCPatternDlg::OnMouseMove(UINTnFlags,CPointpoint)
- {
- //TODO:Addyourmessagehandlercodehereand/orcalldefault
- intx,y;
- CBrushBrush(RGB(0,0,255));
- CBrush*pOldBrush;
- CDC*pDC=GetDC();
- CRgnRgn;
- Rgn.CreateRectRgn(Startx,Starty,Startx+wid-1,Starty+lon-1);
- pDC->SelectClipRgn(&Rgn);
- if((point.x>=Startx)&&(point.x<STARTX+WID)&&(POINT.Y>=Starty)
- &&(point.y<STARTY+LON))m_HCross="AfxGetApp()-"m_HCross;HCURSOR{>LoadStandardCursor(IDC_CROSS);
- SetCursor(m_HCross);
- }
- if((mouseDown==1)&&(point.x>=Startx)&&(point.x<STARTX+WID)&&(point.y>=Starty)&&(point.y<STARTY+LON)){pOldBrush="pDC-"CBrush*.contextdevicetheintobrushSelect>SelectObject(&Brush);
- pDC->Ellipse(point.x-4,point.y-4,point.x+4,point.y+4);
- pDC->SelectObject(pOldBrush);
- x=(int)(point.x-Startx)*32/wid;
- y=(int)(point.y-Starty)*32/lon;
- if(Time==0)
- {
- store[num][Time].x=x;
- store[num][Time].y=y;
- Time++;
- if(y>ymax)
- ymax=y;
- if(y<YMIN)if(xymin="y;">xmax)
- xmax=x;
- if(x<XMIN){if(yTime++;store[num][Time].y="y;"store[num][Time].x="x;"if(x!="store[num][Time-1].x||y!=store[num][Time-1].y)"else}xmin="x;">ymax)
- ymax=y;
- if(y<YMIN)if(xymin="y;">xmax)
- xmax=x;
- if(x<XMIN)}xmin="x;"if(Time>=300)
- {
- AfxMessageBox("当前笔划写入有误(太多)",NULL,NULL);
- OnClear();
- }
- }
- ReleaseDC(pDC);
- DeleteObject(pOldBrush);
- DeleteObject(Rgn);
- DeleteObject(Brush);
- CWnd::OnMouseMove(nFlags,point);
- }
- //清空画板
- voidCPatternDlg::OnClear()
- {
- inti,j,k;
- CDC*pDC=GetDC();
- pDC->PatBlt(Startx,Starty,wid,lon,PATCOPY);
- ReleaseDC(pDC);
- mouseDown=0;
- 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;
- }
- }
- Time=0;
- num=0;
- xmax=0;
- ymax=0;
- xmin=32;
- ymin=32;
- 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;
- }
- }
- return;
- }
- //去除噪声
- intCPatternDlg::Ridnoise(intj)//返回k+1个特征点
- {
- inti,k,ff;
- k=0;
- ff=test.total+1;//ff,当前的处理条数,total为已存条数的最大下标
- queue1[0]=queue[0];
- for(i=1;i<J-1;I++){else}if(abs(y1-y3)are="abs(x1-x3);"y3="store[kk][queue1[j]].y;"x3="store[kk][queue1[j]].x;"y1="store[kk][queue1[j-1]].y;"x1="store[kk][queue1[j-1]].x;"kk="test.total;"kk;intsmax="0;ci=0;vct=0;"s;floatx1,x2,y1,y2,x3,y3,t1,smax,ci,vct,are;j)CPatternDlg::Getarc(int得到arc特征k;returnqueue1[k]="queue[i];"k++;&&abs(store[ff][queue[j-1]].x-store[ff][queue1[k]].x)<2)abs(store[ff][queue[j-1]].y-store[ff][queue1[k]].y)<2if({;}&&(((store[ff][queue[i]].x-store[ff][queue1[k]].x)*(store[ff][queue[i]].x-store[ff][queue[i+1]].x))<0||abs(store[ff][queue[i]].x-store[ff][queue[i+1]].x)<yu2))(abs(store[ff][queue[i]].y-store[ff][queue1[k]].y)<yu1+1+1if||abs(store[ff][queue[i]].y-store[ff][queue[i+1]].y)<yu2))&&(((store[ff][queue[i]].y-store[ff][queue1[k]].y)*(store[ff][queue[i]].y-store[ff][queue[i+1]].y))<0(abs(store[ff][queue[i]].x-store[ff][queue1[k]].x)<yu1+1+1>are)
- are=abs(y1-y3);
- for(t1=queue1[j-1]+1;t1<QUEUE1[J];T1++){if(ss="(x1*y2+x2*y3+x3*y1-x1*y3-x2*y1-x3*y2)/are;"x2="store[kk][t1].x;"y2="store[kk][t1].y;">=yu||s<=-yu)
- {
- if(s*smax==0)
- {
- if(s>0)
- vct=1;
- else
- vct=-1;
- }
- if(s*smax<=0)
- {
- ci++;
- smax=s;
- }
- if(abs(smax)<ABS(S)){}intsmax="s;"floatreturnif(j="=0)"test.detail[tat][j].arc="0;"test.detail[tat][j].relate="10;"test.detail[tat][j].region="16*l+m;"l="(int)((store[tat][queue1[j]].y-ymin)*16/(ymax-ymin+1));"m="(int)((store[tat][queue1[j]].x-xmin)*16/(xmax-xmin+1));"for(j="0;j<=k;j++)"points,初值为-1,定义此条值test.dian[test.total]="k;//k+1"tat="test.total;//没有排序"特征总条数加一test.total++;value;i,j,m,l,tat;此条共k+1个点k)CPatternDlg::Save(intvoid保存特征点ci;ci="vct*ci;">0)
- {
- if((store[tat][queue1[j]].x-store[tat][queue1[j-1]].x)>5.67*abs(store[tat][queue1[j]].y-store[tat][queue1[j-1]].y))
- {
- test.detail[test.total][j].relate=1;
- test.detail[test.total][j].arc=Getarc(j);
- }
- else
- {
- if((store[tat][queue1[j]].x-store[tat][queue1[j-1]].x)<-5.67*abs(store[tat][queue1[j]].y-store[tat][queue1[j-1]].y))
- {
- test.detail[test.total][j].relate=9;
- test.detail[test.total][j].arc=Getarc(j);
- }
- else
- {
- if(5.67*abs(store[tat][queue1[j]].x-store[tat][queue1[j-1]].x)<(store[tat][queue1[j]].y-store[tat][queue1[j-1]].y))
- {
- test.detail[test.total][j].relate=7;
- test.detail[test.total][j].arc=Getarc(j);
- }
- else
- {
- if(-5.67*abs(store[tat][queue1[j]].x-store[tat][queue1[j-1]].x)>(store[tat][queue1[j]].y-store[tat][queue1[j-1]].y))
- {
- test.detail[test.total][j].relate=3;
- test.detail[test.total][j].arc=Getarc(j);
- }
- else
- {
- value=(float)(store[tat][queue1[j]].y-store[tat][queue1[j-1]].y)/(store[tat][queue1[j]].x-store[tat][queue1[j-1]].x);
- if(value<2.747&&value>0.364&&(store[tat][queue1[j]].y-store[tat][queue1[j-1]].y)>0)
- {
- test.detail[test.total][j].relate=6;
- test.detail[test.total][j].arc=Getarc(j);
- }
- if(value<2.747&&value>0.364&&(store[tat][queue1[j]].y-store[tat][queue1[j-1]].y)<0)
- {
- test.detail[test.total][j].relate=4;
- test.detail[test.total][j].arc=Getarc(j);
- }
- if(value>-2.747&&value<-0.364&&(store[tat][queue1[j]].y-store[tat][queue1[j-1]].y)>0)
- {
- test.detail[test.total][j].relate=8;
- test.detail[test.total][j].arc=Getarc(j);
- }
- if(value>-2.747&&value<-0.364&&(store[tat][queue1[j]].y-store[tat][queue1[j-1]].y)<0)
- {
- test.detail[test.total][j].relate=2;
- test.detail[test.total][j].arc=Getarc(j);
- }
- if(value<=5.61&&value>=2.747&&(store[tat][queue1[j]].y-store[tat][queue1[j-1]].y)>0)
- {
- test.detail[test.total][j].relate=76;
- test.detail[test.total][j].arc=Getarc(j);
- }
- if(value<=5.61&&value>=2.747&&(store[tat][queue1[j]].y-store[tat][queue1[j-1]].y)<0)
- {
- test.detail[test.total][j].relate=34;
- test.detail[test.total][j].arc=Getarc(j);
- }
- if(value>=-5.61&&value<=-2.747&&(store[tat][queue1[j]].y-store[tat][queue1[j-1]].y)>0)
- {
- test.detail[test.total][j].relate=78;
- test.detail[test.total][j].arc=Getarc(j);
- }
- if(value>=-5.61&&value<=-2.747&&(store[tat][queue1[j]].y-store[tat][queue1[j-1]].y)<0)
- {
- test.detail[test.total][j].relate=32;
- test.detail[test.total][j].arc=Getarc(j);
- }
- if(value<=0.364&&value>=0.1782&&(store[tat][queue1[j]].y-store[tat][queue1[j-1]].y)>0)
- {
- test.detail[test.total][j].relate=16;
- test.detail[test.total][j].arc=Getarc(j);
- }
- if(value<=0.364&&value>=0.1782&&(store[tat][queue1[j]].y-store[tat][queue1[j-1]].y)<0)
- {
- test.detail[test.total][j].relate=94;
- test.detail[test.total][j].arc=Getarc(j);
- }
- if(value>=-0.364&&value<=-0.1782&&(store[tat][queue1[j]].y-store[tat][queue1[j-1]].y)>0)
- {
- test.detail[test.total][j].relate=98;
- test.detail[test.total][j].arc=Getarc(j);
- }
- if(value>=-0.364&&value<=-0.1782&&(store[tat][queue1[j]].y-store[tat][queue1[j-1]].y)<0)
- {
- test.detail[test.total][j].relate=12;
- test.detail[test.total][j].arc=Getarc(j);
- }
- }
- }
- }
- }
- }
- }
- for(i=0;i<50;i++)
- queue[i]=-1;
- for(i=0;i<40;i++)
- queue1[i]=-1;//must
- }
- //进一步处理数据,提取特征
- voidCPatternDlg::DealData()
- {
- inti,j,k,num1,Time1;
- Inorder();
- for(num1=0;store[num1][0].x>-1;num1++)//第几条线
- {
- for(Time1=0,j=0;store[num1][Time1].x>-1;Time1++)
- {
- if(Time1==0)
- {
- queue[j]=Time1;j++;
- }
- if(Time1>0&&store[num1][Time1+1].x==-1)
- {
- queue[j]=Time1;j++;
- }
- if(Time1>0&&store[num1][Time1+1].x!=-1)
- {
- if((store[num1][Time1+1].x-store[num1][Time1].x)*(store[num1][Time1-1].x-store[num1][Time1].x)>0||(store[num1][Time1+1].y-store[num1][Time1].y)*(store[num1][Time1-1].y-store[num1][Time1].y)>0)
- {
- queue[j]=Time1;j++;
- }
- if(store[num1][Time1-1].x-store[num1][Time1].x==0)//&&(store[num1][Time1+1].x-store[num1][Time1].x!0))
- {
- for(i=1;store[num1][Time1-1-i].x==store[num1][Time1-1].x&&(Time1-1-i)>=0;i++){;}
- if((store[num1][Time1+1].x-store[num1][Time1].x)*(store[num1][Time1-1-i].x-store[num1][Time1].x)>0)
- {
- queue[j]=Time1;j++;
- }
- }
- if(store[num1][Time1-1].y-store[num1][Time1].y==0)//&&(store[num1][Time1+1].y-store[num1][Time1].y)<0)
- {
- for(i=1;store[num1][Time1-1-i].y==store[num1][Time1-1].y&&(Time1-1-i)>=0;i++){;}
- if((store[num1][Time1+1].y-store[num1][Time1].y)*(store[num1][Time1-1-i].y-store[num1][Time1].y)>0)
- {
- queue[j]=Time1;j++;
- }
- }
- }
- }
- k=Ridnoise(j);//共j点,0到j-1
- Save(k);
- }
- }
- CPatternDlg::OnRecogch()//清空获取的特征
- {
- inti,j,k;
- 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;
- }
- }
- return(1);
- }
- voidCPatternDlg::OnExitMenu()
- {
- //TODO:Addyourcommandhandlercodehere
- OnEsp();
- }
- voidCPatternDlg::OnAboutMenu()
- {
- CAboutDlgcabout;
- //TODO:Addyourcommandhandlercodehere
- if(cabout.DoModal()==1)
- {;}
- }
- voidCPatternDlg::OnSaveMenu()
- {
- //TODO:Addyourcommandhandlercodehere
- CFilecf;
- intk,j;
- if(cf.Open("mydata.dat",CFile::modeReadWrite)==NULL)
- {
- AfxMessageBox("打开文件失败,/n您最好退出程序");
- }
- else
- {
- cf.SeekToEnd();
- cf.Write(&tez[zong].zifu,sizeof(char)*2);
- cf.Write(&tez[zong].total,sizeof(int));
- for(j=0;j<=tez[zong].total;j++)
- {
- cf.Write(&tez[zong].dian[j],sizeof(int));
- }
- for(j=0;j<=tez[zong].total;j++)
- {
- for(k=0;k<=tez[zong].dian[j];k++)
- {
- cf.Write(&tez[zong].detail[j][k].relate,sizeof(int));
- cf.Write(&tez[zong].detail[j][k].region,sizeof(int));
- cf.Write(&tez[zong].detail[j][k].arc,sizeof(int));
- }
- }
- cf.Close();
- }
- }
- voidCPatternDlg::OnOpenMenu()
- {
- CFilecf;
- chars[20];
- intj,k;
- intnFileSize;
- inttt;
- if(cf.Open("mydata.dat",CFile::modeReadWrite)==NULL)
- {
- AfxMessageBox("打开文件失败,/n您最好退出程序");
- }
- else
- {
- cf.SeekToBegin();
- nFileSize=cf.GetLength();
- for(zong=0,tt=0;tt<NFILESIZE-1;ZONG++){}intfor(j="0;j<=tez[zong].total;j++)"voidfor(num1="0;store[num1][0].x"xxbegin,xxend,yybegin,yyend,total;i,j,k,num1,Time1;CPatternDlg::Inorder()OK?);AfxMessageBox(?SaveCPatternDlg::OnSaveMenu1()AfxMessageBox(s);%d?,zong);sprintf(s,?读入正确,共有字);cf.Close(zong--;tt="tt+sizeof(char)*2;"sizeof(int));cf.Read(&tez[zong].detail[j][k].arc,cf.Read(&tez[zong].detail[j][k].region,cf.Read(&tez[zong].detail[j][k].relate,sizeof(int));for(k="0;k<=tez[zong].dian[j];k++)"cf.Read(&tez[zong].dian[j],cf.Read(&tez[zong].total,sizeof(char)*2);cf.Read(&tez[zong].zifu,最后减一>-1;num1++)//第几条线
- {
- xxbegin=store[num1][0].x;
- yybegin=store[num1][0].y;
- for(Time1=0,j=0;store[num1][Time1].x>-1;Time1++)
- {;}
- total=Time1;
- xxend=store[num1][Time1-1].x;
- yyend=store[num1][Time1-1].y;
- for(Time1=0;store[num1][Time1].x>-1;Time1++)
- {
- storeback[0][total-Time1-1].x=store[num1][Time1].x;
- storeback[0][total-Time1-1].y=store[num1][Time1].y;
- }
- if(abs(xxbegin-xxend)>2*abs(yybegin-yyend)&&(xxbegin>xxend))
- {
- for(j=0;j<TOTAL;J++){}if(abs(xxbegin-xxend)<="2*abs(yybegin-yyend)&&(yybegin"store[num1][j].y="storeback[0][j].y;"store[num1][j].x="storeback[0][j].x;">yyend))
- {
- for(j=0;j<TOTAL;J++){}store[num1][j].y="storeback[0][j].y;"store[num1][j].x="storeback[0][j].x;"pre<>
- <SCRIPTsrc="/inc/gg_read2.js"></SCRIPT>
需要源码的请留下地址,我给大家发
相关推荐
MATLAB的手写字符识别[数字,字母,符号][GUI框架]
采用tensorflow手写字体的识别。tensorflow框架的具体原理详见网络资源,代码可直接运行。
简单易用的图形手势识别器,能够添加、删除和识别所有一笔画出的手势图案。 将该功能集成到App中,可以实现各种图案对应不同指令,例如画一个五角星打开...也可以识别数字、字母等来实现手写输入,无限可能等你发掘。
手写识别器这是我用来测试由WWDC'18期间由Apple发布的CreateML框架创建的MLModel的应用程序关于MLModel 我使用训练了该模型,其准确性超过85% 该模型超轻量级(约800KBs)关于应用程序可以在300x300px的UIImageview...
3.1.5 字符识别(字母、数字、手写体、汉字、验证码) 3.1.6 病灶识别 3.1.7 花朵、药材、水果蔬菜识别 3.1.8 指纹、手势、虹膜识别 3.1.9 路面状态和裂缝识别 3.1.10 行为识别 3.1.11 万用表和表盘识别 ...
3.1.5 字符识别(字母、数字、手写体、汉字、验证码) 3.1.6 病灶识别 3.1.7 花朵、药材、水果蔬菜识别 3.1.8 指纹、手势、虹膜识别 3.1.9 路面状态和裂缝识别 3.1.10 行为识别 3.1.11 万用表和表盘识别 ...
Neuroph OCR-手写识别技术可以识别手写字母和字符。 它是从Java神经网络框架-Neuroph派生而来的引擎,因此可以用作独立项目或Neuroph插件。
数据集采集了mnist及emnist中的数字、字母数据,运算符号为项目组手写制作。 图片分割使用了连通域与水平投影共同实现。 项目通过flask框架部署在服务器。 这是本人参与制作的第一个比课程设计大的项目。仅用来记录...
17.1 .Net 框架结构提供的 I/O 方式 .215 17.2 文件存储管理 .217 17.3 读 写 文 件 .222 17.4 异步文件操作 .227 17.5 小 结 .234 第十八章 高 级 话 题 .235 18.1 注册表编程 .235 18.2 在 C #代码...