資源簡介
Gabor特征的C++代碼,用于人臉識別,包括Gabor特征的實部和虛部特征提取。
代碼片段和文件信息
/*
Description: Gabor?API?usage
Author: Adriaan?Tijsseling?(AGT)
Copyright:? (c)?Copyright?2002-3?Adriaan?Tijsseling.?All?rights?reserved.
*/
#include?
#include?
#include?
#include?“GaborGlobal.h“ //?contains?project-wide?defines?constants?and?globals
#include?“GaborJet.h“
#include?“ContrastFilter.h“
#include?“LogPolar.h“
#include?“PGMImage.h“
#include?“Utilities.h“
//?use?these?defines?to?toggle?the?use?of?log-polar?and?contrastfilter
#define?kUseLogPolar 0
#define?kUseContrast 1
//?set?to?use?color?or?grayscale
#define kUsingColor 0
//?GLOBAL?
bool kSaveFilter?=?true; //?in?case?of?multiple?files?we?save?GFs?only?once
bool kVerbosity?=?true;? //?whether?to?output?any?messages?or?not
//?LOCAL?GLOBALS
//?These?are?the?settings?for?the?Gabor?filter?jet.?These?are?of?course?modifiable.
int gx?=?32; // -X :?horizontal?size?of?filter
int gy?=?32; // -Y :?vertical?size?of?filter
int sx?=?28; // -x :?horizontal?spacing?of?filter?i.e.?overlap?is?gx?-?sx?pixels
int sy?=?28; // -y :?vertical?spacing?of?filter
float s?=?2.0; // -s :?sigma?modulator
int a?=?8; // -a :?number?of?angles
int f?=?1; // -f :?number?of?frequencies
float l?=?1; // -l :?lower?bound?of?frequency
float u?=?2; // -u :?upper?bound?of?frequency
//?PROTOTYPES
float* ProcessFile(?char*?int***?int?int?float*?int*?);
float*? ProcessChannel(?float**?int?int?float*?int*?int?char*?);
void Usage(?void?);
//?process?command?line?arguments?and?filter?selected?files
int?main(?int?argc?char?*argv[]?)
{
int arg;
char file[256];
cout?<“#?“;
if?(?argc?>?1?)
{
//?run?down?each?argument
arg?=?1;
while(?arg? {
//?check?if?-h?is?called
if(?strcmp(?argv[arg]?“-h“)?==?0?)
{
arg++;
Usage();
}
if(?strcmp(?argv[arg]?“-X“)?==?0?)
{
cout?< arg++;
if?(?argv[arg]?==?NULL?)?Usage();
cout?< gx?=?atoi(?argv[arg]?);
goto?loop;
}
if(?strcmp(?argv[arg]?“-Y“)?==?0?)
{
cout?< arg++;
if?(?argv[arg]?==?NULL?)?Usage();
cout?< gy?=?atoi(?argv[arg]?);
goto?loop;
}
if(?strcmp(?argv[arg]?“-x“)?==?0?)
{
cout?< arg++;
if?(?argv[arg]?==?NULL?)?Usage();
cout?< sx?=?atoi(?argv[arg]?);
goto?loop;
}
if(?strcmp(?argv[arg]?“-y“)?==?0?)
{
cout?< arg++;
if?(?argv[arg]?==?NULL?)?Usage();
cout?< sy?=?atoi(?argv[arg]?);
goto?loop;
}
if(?strcmp(?argv[arg]?“-s“)?==?0?)
{
cout?< arg++;
if?(?argv[arg]?==?NULL?)?Usage();
cout?< s?=?atof(?argv[arg]?);
goto?loop;
}
if(?strcmp(?argv[arg]?“-a“)?==?0?)
{
cout?< arg++;
if?(?argv[arg]?==?NULL?)?Usage();
cout?< a?=?atoi(?argv[arg]?);
goto?loop;
}
- 上一篇:A*算法 機器人路徑規劃
- 下一篇:bmp 圖片轉YUV420數組
評論
共有 條評論