資源簡介
通過連接數據庫,利用opencv自動生成比賽對陣圖
代碼片段和文件信息
#include?“stdafx.h“
#include?
#include?
#include?
#include?
#include?“cv.h“
#include?“highgui.h“
#include?“iostream.h“
#include?“CvxText.h“
CvxText::CvxText(const?char?*freeType)
{
???assert(freeType?!=?NULL);
???//?打開字庫文件?創建一個字體
???if(FT_Init_FreeType(&m_library))?throw;
???if(FT_New_Face(m_library?freeType?0?&m_face))?throw;
???//?設置字體輸出參數
???restoreFont();
???//?設置C語言的字符集環境
???setlocale(LC_ALL?““);
}
//?釋放FreeType資源
CvxText::~CvxText()
{
???FT_Done_Face????(m_face);
???FT_Done_FreeType(m_library);
}
//?設置字體參數:
//
//?font?????????-?字體類型?目前不支持
//?size?????????-?字體大小/空白比例/間隔比例/旋轉角度
//?underline???-?下畫線
//?diaphaneity???-?透明度
void?CvxText::getFont(int?*type?CvScalar?*size?bool?*underline?float?*diaphaneity)
{
???if(type)?*type?=?m_fontType;
???if(size)?*size?=?m_fontSize;
???if(underline)?*underline?=?m_fontUnderline;
???if(diaphaneity)?*diaphaneity?=?m_fontDiaphaneity;
}
void?CvxText::setFont(int?*type?CvScalar?*size?bool?*underline?float?*diaphaneity)
{
???//?參數合法性檢查
???if(type)
???{
??????if(type?>=?0)?m_fontType?=?*type;
???}
???if(size)
???{
??????m_fontSize.val[0]?=?fabs(size->val[0]);
??????m_fontSize.val[1]?=?fabs(size->val[1]);
??????m_fontSize.val[2]?=?fabs(size->val[2]);
??????m_fontSize.val[3]?=?fabs(size->val[3]);
???}
???if(underline)
???{
??????m_fontUnderline???=?*underline;
???}
???if(diaphaneity)
???{
??????m_fontDiaphaneity?=?*diaphaneity;
???}
}
//?恢復原始的字體設置
void?CvxText::restoreFont()
{
???m_fontType?=?0;????????????//?字體類型(不支持)
???m_fontSize.val[0]?=?20;??????//?字體大小
???m_fontSize.val[1]?=?0.5;???//?空白字符大小比例
???m_fontSize.val[2]?=?0.1;???//?間隔大小比例
???m_fontSize.val[3]?=?0;??????//?旋轉角度(不支持)
???m_fontUnderline???=?false;???//?下畫線(不支持)
???m_fontDiaphaneity?=?1.0;???//?色彩比例(可產生透明效果)
???//?設置字符大小
???FT_Set_Pixel_Sizes(m_face?(int)m_fontSize.val[0]?0);
}
//?輸出函數(顏色默認為黑色)
int?CvxText::putText(IplImage?*img?const?char????*text?CvPoint?pos)
{
???return?putText(img?text?pos?CV_RGB(255255255));
}
int?CvxText::putText(IplImage?*img?const?wchar_t?*text?CvPoint?pos)
{
???return?putText(img?text?pos?CV_RGB(255255255));
}
//
int?CvxText::putText(IplImage?*img?const?char????*text?CvPoint?pos?CvScalar?color)
{
???if(img?==?NULL)?return?-1;
???if(text?==?NULL)?return?-1;
???//
???int?i;
???for(i?=?0;text[i]?!=?‘\0‘;?++i)???//注意是\0??而不是/0
???{
??????wchar_t?wc?=?text[i];
??????//cout< ??????//?解析雙字節符號
???//setlocale(LC_ALL““);
??????if(!isascii(wc))?
??mbtowc(&wc?&text[i++]?2);
??????//?輸出當前的字符
??????putWChar(img?wc?pos?color);
???}
???return?i;
???/*wchar_t?wc[30];
???mbtowc(&wc?&text?30);
???return?0;*/
}
int?CvxText::putText(IplImage?*img?const?wchar_t?*text?CvPoint?pos?CvScalar?color)
{
???if(img?==?NULL)?return?-1;
???if(text?==?NULL)?return?-1;
???//
???int?i;
???for(i?=?0;?t
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件???????4832??2011-09-27?14:58??matchschedule\CvxText.cpp
?????文件???????5500??2011-09-26?20:42??matchschedule\CvxText.h
?????文件??????58913??2011-10-10?14:53??matchschedule\Debug\CvxText.obj
?????文件????1257547??2011-11-10?19:48??matchschedule\Debug\matchschedule.exe
?????文件?????422724??2011-11-10?19:48??matchschedule\Debug\matchschedule.ilk
?????文件??????71979??2011-11-10?19:48??matchschedule\Debug\matchschedule.obj
?????文件????5756944??2011-10-10?14:52??matchschedule\Debug\matchschedule.pch
?????文件????1885184??2011-11-10?19:48??matchschedule\Debug\matchschedule.pdb
?????文件?????224170??2010-11-20?20:19??matchschedule\Debug\msado15.tlh
?????文件?????168940??2010-11-20?20:19??matchschedule\Debug\msado15.tli
?????文件?????119743??2011-10-10?14:52??matchschedule\Debug\StdAfx.obj
?????文件?????295936??2011-11-10?19:48??matchschedule\Debug\vc60.idb
?????文件?????651264??2011-11-10?19:48??matchschedule\Debug\vc60.pdb
?????文件????2656810??2011-09-27?09:38??matchschedule\freetype246ST_D.lib
?????文件???????3890??2011-09-26?15:49??matchschedule\ft2build.h
?????文件???????4920??2011-11-10?19:48??matchschedule\matchschedule.cpp
?????文件???????4852??2011-10-10?13:51??matchschedule\matchschedule.dsp
?????文件????????532??2011-10-10?13:33??matchschedule\matchschedule.dsw
?????文件?????173056??2011-11-10?23:42??matchschedule\matchschedule.ncb
?????文件??????50688??2011-11-10?23:42??matchschedule\matchschedule.opt
?????文件???????1732??2011-11-10?19:48??matchschedule\matchschedule.plg
?????文件?????224088??2010-11-20?20:19??matchschedule\msado15.tlh
?????文件?????168899??2010-11-20?20:19??matchschedule\msado15.tli
?????文件???????1250??2011-10-10?13:33??matchschedule\ReadMe.txt
?????文件???11785184??2009-06-11?05:25??matchschedule\simkai.ttf
?????文件????????300??2011-10-10?13:33??matchschedule\StdAfx.cpp
?????文件????????808??2011-10-10?14:52??matchschedule\StdAfx.h
?????文件???10808952??2008-06-25?13:32??matchschedule\wqy-zenhei.ttf
?????目錄??????????0??2011-11-10?19:48??matchschedule\Debug
?????目錄??????????0??2011-11-10?23:42??matchschedule
............此處省略3個文件信息
評論
共有 條評論