资源简介
基于码书的运动检测算法,非常好的代码,值得参考。
代码片段和文件信息
#include “highgui.h“
#include
#include
#include “cvaux.h“
#include “codeb.h“
int CVCONTOUR_APPROX_LEVEL = 2;
int CVCLOSE_ITR = 1;
#define CV_CVX_WHITE CV_RGB(0xff0xff0xff)
#define CV_CVX_BLACK CV_RGB(0x000x000x00)
codeBook* cA;
codeBook* cC;
codeBook* cD;
int maxMod[CHANNELS];
int minMod[CHANNELS];
unsigned cbBounds[CHANNELS];
bool ch[CHANNELS];
int nChannels = CHANNELS;
int imageLen = 0;
uchar *pColor;
int Td;
int Tadd;
int Tdel;
int T=50;
int Fadd=35;
int Tavgstale=50;
int Fd=2;
int Tavgstale_cD=50;
int fgcount=0;
float beta=0.1f;
float gamma=0.1f;
float forgratio=0.0f;
float Tadap_update=0.4f;
int clear_stale_entries(codeBook &c);
uchar background_Diff(uchar *p codeBook &c int numChannels int *minMod int *maxMod);
int update_codebook_model(uchar* pcodeBook& cunsigned* cbBoundsint numChannels);
int trainig_codebook(uchar* pcodeBook& cunsigned* cbBoundsint numChannels);
int training_clear_stale_entries(codeBook &c);
int det_update_codebook_cC(uchar* pcodeBook& cunsigned* cbBoundsint numChannels);
int det_update_codebook_cD(uchar* pcodeBook& cunsigned* cbBoundsint numChannels int numframe);
int realtime_clear_stale_entries_cC(codeBook &c int FrmNum);
int realtime_clear_stale_entries_cD(codeBook &c int FrmNum);
int cD_to_cC(codeBook &d codeBook &c int FrmNum);
uchar background_diff_realtime(uchar* pcodeBook& cint numChannelsint* minModint* maxMod);
void help() {
printf(
“***Keep the focus on the video windows NOT the consol***\n“
“INTERACTIVE PARAMETERS:\n“
“\tESCqQ - quit the program\n“
“\th - print this help\n“
“\tp - pause toggle\n“
“\ts - single step\n“
“\tr - run mode (single step off)\n“
“=== CODEBOOK PARAMS ===\n“
“\tyuv- only adjust channel 0(y) or 1(u) or 2(v) respectively\n“
“\ta - adjust all 3 channels at once\n“
“\tb - adjust both 2 and 3 at once\n“
“\tio - bump upper threshold updown by 1\n“
“\tkl - bump lower threshold updown by 1\n“
“\tzx - bump Fadd threshold updown by 1\n“
“\tnm - bump Tavgstale threshold updown by 1\n“
“\t Fadd小更新快Tavgstale大更新快\n“
);
}
int count_Segmentation(codeBook *c IplImage *I int numChannels int *minMod int *maxMod)
{
int count = 0i;
uchar *pColor;
int imageLen = I->width * I->height;
//GET baseLINE NUMBER OF FG PIXELS FOR Iraw
pColor = (uchar *)((I)->imageData);
for(i=0; i {
if(background_Diff(pColor c[i] numChannels minMod maxMod))
count++;
pColor += 3;
}
fgcount=count;
return(fgcount);
}
void connected_Components(IplImage *mask int poly1_hull0 float perimScale int *num CvRect *bbs CvPoint *centers)
{
static CvMemStorage* mem_storage = NULL;
static CvSeq* contours = NULL;
//CLEAN UP RAW MASK
cvMorphologyEx( mask mask NULL NULL CV_MOP_OPEN CVCLOSE_ITR );
cvMorphologyEx( mask mask N
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2014-09-26 17:02 基于码书的运动检测\
文件 515 2009-06-07 10:40 基于码书的运动检测\codeb.h
文件 30651 2009-11-24 17:16 基于码书的运动检测\Realtime_online_cb_det.cpp
文件 3823 2009-06-08 09:38 基于码书的运动检测\Realtime_online_cb_det.dsp
文件 569 2009-05-03 18:26 基于码书的运动检测\Realtime_online_cb_det.dsw
文件 475136 2009-06-26 10:59 基于码书的运动检测\Realtime_online_cb_det.opt
文件 881 2009-06-26 10:55 基于码书的运动检测\Realtime_online_cb_det.plg
文件 909 2009-10-27 10:04 基于码书的运动检测\Realtime_online_cb_det.sln
文件 12800 2009-11-30 10:42 基于码书的运动检测\Realtime_online_cb_det.suo
文件 5313 2009-11-24 17:09 基于码书的运动检测\Realtime_online_cb_det.vcproj
文件 1427 2009-10-27 10:07 基于码书的运动检测\Realtime_online_cb_det.vcproj.CHINA-AA6536103.Administrator.user
文件 1403 2009-11-30 10:42 基于码书的运动检测\Realtime_online_cb_det.vcproj.WCY.Administrator.user
- 上一篇:序列脉冲检测器
- 下一篇:医院门诊收费系统2009毕业论文
评论
共有 条评论