国产免费AV|泡泡玛特欧洲总部将设在伦敦|中文天堂网www新版资源在线|一本久道综合在线中文|国精产品一二三产区的使用方法|香蕉鱼在线观看|www.27eee
ELEOK
標題:
基于SVM的手寫數字識別上位機(源碼) VC++2010 + OpenCV2.4.9開發
[打印本頁]
作者:
coolice
時間:
2020-4-29 22:54
標題:
基于SVM的手寫數字識別上位機(源碼) VC++2010 + OpenCV2.4.9開發
一個基于SVM的數字手寫識別分享給大家;源碼見附件, VS2010 + OpenCV2.4.9開發
HandWrite.rar
(15.41 MB, 售價: 2 E幣)
2020-4-29 22:53 上傳
點擊文件名下載附件
售價: 2 E幣
[記錄]
[
購買
]
識別效果如下圖所示:
170640zcjhg55uumet40hx.png
(11.52 KB)
下載附件
2020-4-29 22:51 上傳
部分源代碼
void CHandWriteDlg::OnBnClickedButtonIdentify()
{
// TODO: 在此添加控件通知處理程序代碼
if(m_firstFlag == false)
{
MessageBox(_T("請現在手寫區寫入數字!"));
return ;
}
CvSVM svm;
IplImage *test;
CString strResult;
char* str;
CRect pRect;
CWnd* pwnd=GetDlgItem(IDC_STATIC_HAND);//獲取靜態控件的指針 CRect pRect;
CDC* pDC=pwnd->GetDC(); //使用控件指針創建繪圖用的DC
pwnd->GetClientRect(&pRect);
int w, h;
w = pRect.right - pRect.left;
h = pRect.bottom - pRect.top;
CBitmap bm;
bm.CreateCompatibleBitmap(pDC, w, h);
CDC memdc;
memdc.CreateCompatibleDC(pDC);
CBitmap*pOld=memdc.SelectObject(&bm);
memdc.BitBlt( 0, 0, w, h, pDC, pRect.left, pRect.top, SRCCOPY );
BITMAP btm;
bm.GetBitmap(&btm);
DWORD size=btm.bmWidthBytes*btm.bmHeight;
LPSTR lpData=(LPSTR)::GlobalAlloc(GPTR,size);
BITMAPINFOHEADER bih;
bih.biBitCount=btm.bmBitsPixel;
bih.biClrImportant=0;
bih.biClrUsed=0;
bih.biCompression=0;
bih.biHeight=btm.bmHeight;
bih.biPlanes=1;
bih.biSize=sizeof(BITMAPINFOHEADER);
bih.biSizeImage=size;
bih.biWidth=btm.bmWidth;
bih.biXPelsPerMeter=0;
bih.biYPelsPerMeter=0;
GetDIBits(memdc,bm,0,bih.biHeight,lpData,(BITMAPINFO*)&bih,DIB_RGB_COLORS);
BITMAPFILEHEADER bfh;
bfh.bfReserved1=bfh.bfReserved2=0;
bfh.bfType=((WORD)('M'<< 8)|'B');
bfh.bfSize=54+size;
bfh.bfOffBits=54;
CFile bf;
if(bf.Open(_T("a.bmp"),CFile::modeCreate|CFile::modeWrite))
{
bf.Write(&bfh,sizeof(BITMAPFILEHEADER));
bf.Write(&bih,sizeof(BITMAPINFOHEADER));
bf.Write(lpData,size);
……………………
…………限于本文篇幅 余下代碼請下載附件…………
復制代碼
歡迎光臨 ELEOK (http://m.afoofa.cn/)
Powered by Discuz! X5.0