資源簡介
說明:
1. 本代碼是本人目前所做項目前期所做的工作,主要是考察Gabor濾波方法對項目文件的處理效果,驗證一下前期理論;
2. 圖庫是項目中應(yīng)用到的工程圖,只給出幾幅圖像,用于代碼的分享學(xué)習(xí);
3. 各位看到的代碼,如果出現(xiàn)不正確的地方,或無法運(yùn)行,麻煩到我的博客回復(fù),本程序的相關(guān)博客地址:http://blog.csdn.net/jorg_zhao/article/details/47153115
代碼片段和文件信息
#include?“stdafx.h“//加到工程后這個就要添上
#include?“CvvImage.h“
//////////////////////////////////////////////////////////////////////
//?Construction/Destruction
//////////////////////////////////////////////////////////////////////
CV_INLINE?RECT?NormalizeRect(?RECT?r?);
CV_INLINE?RECT?NormalizeRect(?RECT?r?)
{
????int?t;
????if(?r.left?>?r.right?)
????{
????????t?=?r.left;
????????r.left?=?r.right;
????????r.right?=?t;
????}
????if(?r.top?>?r.bottom?)
????{
????????t?=?r.top;
????????r.top?=?r.bottom;
????????r.bottom?=?t;
????}
????return?r;
}
CV_INLINE?CvRect?RectToCvRect(?RECT?sr?);
CV_INLINE?CvRect?RectToCvRect(?RECT?sr?)
{
????sr?=?NormalizeRect(?sr?);
????return?cvRect(?sr.left?sr.top?sr.right?-?sr.left?sr.bottom?-?sr.top?);
}
CV_INLINE?RECT?CvRectToRect(?CvRect?sr?);
CV_INLINE?RECT?CvRectToRect(?CvRect?sr?)
{
????RECT?dr;
????dr.left?=?sr.x;
????dr.top?=?sr.y;
????dr.right?=?sr.x?+?sr.width;
????dr.bottom?=?sr.y?+?sr.height;
????return?dr;
}
CV_INLINE?IplROI?RectToROI(?RECT?r?);
CV_INLINE?IplROI?RectToROI(?RECT?r?)
{
????IplROI?roi;
????r?=?NormalizeRect(?r?);
????roi.xOffset?=?r.left;
????roi.yOffset?=?r.top;
????roi.width?=?r.right?-?r.left;
????roi.height?=?r.bottom?-?r.top;
????roi.coi?=?0;
????return?roi;
}
void?FillBitmapInfo(?BITMAPINFO*?bmi?int?width?int?height?int?bpp?int?origin?)
{
????assert(?bmi?&&?width?>=?0?&&?height?>=?0?&&?(bpp?==?8?||?bpp?==?24?||?bpp?==?32));
????BITMAPINFOHEADER*?bmih?=?&(bmi->bmiHeader);
????memset(?bmih?0?sizeof(*bmih));
????bmih->biSize?=?sizeof(BITMAPINFOHEADER);
????bmih->biWidth?=?width;
????bmih->biHeight?=?origin???abs(height)?:?-abs(height);
????bmih->biPlanes?=?1;
????bmih->biBitCount?=?(unsigned?short)bpp;
????bmih->biCompression?=?BI_RGB;
????if(?bpp?==?8?)
????{
????????RGBQUAD*?palette?=?bmi->bmiColors;
????????int?i;
????????for(?i?=?0;?i?256;?i++?)
????????{
????????????palette[i].rgbBlue?=?palette[i].rgbGreen?=?palette[i].rgbRed?=?(BYTE)i;
????????????palette[i].rgbReserved?=?0;
????????}
????}
}
CvvImage::CvvImage()
{
????m_img?=?0;
}
void?CvvImage::Destroy()
{
????cvReleaseImage(?&m_img?);
}
CvvImage::~CvvImage()
{
????Destroy();
}
bool?CvvImage::Create(?int?w?int?h?int?bpp?int?origin?)
{
????const?unsigned?max_img_size?=?10000;
????if(?(bpp?!=?8?&&?bpp?!=?24?&&?bpp?!=?32)?||
????????(unsigned)w?>=?max_img_size?||?(unsigned)h?>=?max_img_size?||
????????(origin?!=?IPL_ORIGIN_TL?&&?origin?!=?IPL_ORIGIN_BL))
????{
????????assert(0);?//?most?probably?it?is?a?programming?error
????????return?false;
????}
????if(?!m_img?||?Bpp()?!=?bpp?||?m_img->width?!=?w?||?m_img->height?!=?h?)
????{
????????if(?m_img?&&?m_img->nSize?==?sizeof(IplImage))
????????????Destroy();
????????/*?prepare?IPL?header?*/
????????m_img?=?cvCreateImage(?cvSize(?w?h?)?IPL_DEPTH_8U?bpp/8?);
????}
????if(?m_img?)
????????m_img->origin?=?origin?==?0???
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件?????227328??2015-07-31?13:53??TyreX\Debug\TyreX.exe
?????文件????2457780??2015-07-31?13:53??TyreX\Debug\TyreX.ilk
?????文件????9269248??2015-07-31?13:53??TyreX\Debug\TyreX.pdb
?????文件???94044160??2015-07-29?17:37??TyreX\ipch\tyrex-dbe03ec0\tyrex-b5118968.ipch
?????文件???????7588??2015-07-20?20:16??TyreX\TyreX\CvvImage.cpp
?????文件???????2153??2015-04-09?13:48??TyreX\TyreX\CvvImage.h
?????文件?????170689??2015-07-29?17:43??TyreX\TyreX\Debug\CvvImage.obj
?????文件?????167456??2015-07-31?13:43??TyreX\TyreX\Debug\Gabor.obj
?????文件?????911279??2015-07-29?17:37??TyreX\TyreX\Debug\stdafx.obj
?????文件???????3825??2015-07-31?13:53??TyreX\TyreX\Debug\TyreX.log
?????文件?????219356??2015-07-31?13:53??TyreX\TyreX\Debug\TyreX.obj
?????文件???46989312??2015-07-29?17:37??TyreX\TyreX\Debug\TyreX.pch
?????文件??????70556??2015-07-31?13:53??TyreX\TyreX\Debug\TyreX.res
?????文件???????3500??2015-07-31?13:53??TyreX\TyreX\Debug\TyreX.tlog\cl.command.1.tlog
?????文件?????112392??2015-07-31?13:53??TyreX\TyreX\Debug\TyreX.tlog\CL.read.1.tlog
?????文件???????5184??2015-07-31?13:53??TyreX\TyreX\Debug\TyreX.tlog\CL.write.1.tlog
?????文件???????1880??2015-07-31?13:53??TyreX\TyreX\Debug\TyreX.tlog\li
?????文件???????6118??2015-07-31?13:53??TyreX\TyreX\Debug\TyreX.tlog\li
?????文件???????1052??2015-07-31?13:53??TyreX\TyreX\Debug\TyreX.tlog\li
?????文件????????514??2015-07-31?13:53??TyreX\TyreX\Debug\TyreX.tlog\rc.command.1.tlog
?????文件???????2852??2015-07-31?13:53??TyreX\TyreX\Debug\TyreX.tlog\rc.read.1.tlog
?????文件????????230??2015-07-31?13:53??TyreX\TyreX\Debug\TyreX.tlog\rc.write.1.tlog
?????文件????????170??2015-07-31?13:53??TyreX\TyreX\Debug\TyreX.tlog\TyreX.lastbuildstate
?????文件?????240736??2015-07-31?13:53??TyreX\TyreX\Debug\TyreXDlg.obj
?????文件????2845696??2015-07-31?13:53??TyreX\TyreX\Debug\vc120.idb
?????文件????9760768??2015-07-31?13:53??TyreX\TyreX\Debug\vc120.pdb
?????文件???????4638??2015-07-31?13:43??TyreX\TyreX\Gabor.cpp
?????文件???????2688??2015-07-31?13:43??TyreX\TyreX\Gabor.h
?????文件???????3823??2015-07-29?17:17??TyreX\TyreX\ReadMe.txt
????.......?????67777??2013-07-22?01:18??TyreX\TyreX\res\TyreX.ico
............此處省略36個文件信息
- 上一篇:新浪微博曬號軟件(桌面提取器5.0)
- 下一篇:Objc中國上的書swift4
評論
共有 條評論