背景法比较两种.pdf
文本预览下载声明
#include stdafx.h
#include cv.h
#include highgui.h
#include stdio.h
#include stdlib.h
#include ctype.h
#include avg_background.h
#include cv_yuv_codebook.h
//VARIABLES for CODEBOOK METHOD:
codeBook *cB; //This will be our linear model of the image, a vector
//of lengh = height*width
int maxMod[CHANNELS]; //Add these (possibly negative) number onto max
// level when code_element determining if new pixel is foreground
int minMod[CHANNELS]; //Subract these (possible negative) number from min
//level code_element when determining if pixel is foreground
unsigned cbBounds[CHANNELS]; //Code Book bounds for learning
bool ch[CHANNELS]; //This sets what channels should be adjusted for background
bounds
int nChannels = CHANNELS;
int imageLen = 0;
uchar *pColor; //YUV pointer
void help() {
printf(\nLearn background and find foreground using simple average and average
difference learning method:\n
\nUSAGE:\n ch9_background startFrameCollection# endFrameCollection# [movie
filename, else from camera]\n
If from AVI, then optionally add HighAvg, LowAvg, HighCB_Y LowCB_Y HighCB_U
LowCB_U HighCB_V LowCB_V\n\n
***Keep the focus on the video windows, NOT the consol***\n\n
INTERACTIVE PARAMETERS:\n
\tESC,q,Q - quit the program\n
\th - print this help\n
\tp - pause toggle\n
\ts - single step\n
\tr - run mode (single step off)\n
=== AVG PARAMS ===\n
\t- - bump high threshold UP by 0.25\n
\t= - bump high threshold DOWN by 0.25\n
\t[ - bump low threshold UP by 0.25\n
\t] - bump low threshold DOWN by 0.25\n
=== CODEBOOK PARAMS ===\n
\ty,u,v- 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
\ti,o
显示全部