(strcmp(argv[i],"-p")==0){ //读取参数文件parameters.yml
if (argc>i){
//FileStorage类的读取方式可以是:FileStorage fs(".\\parameters.yml", FileStorage::READ);
fs.open(argv[i+1], FileStorage::READ);
}
else
print_help(argv);
}
if (strcmp(argv[i],"-no_tl")==0){ //仅在第一帧训练(无追踪,无学习))
tl = false;
}
if (strcmp(argv[i],"-r")==0){ //重复录像,第一次学习,第二次检测
rep = true;
}
}
}
/*
运行程序时:
%To run from camera
./run_tld -p ../parameters.yml
%To run from file
./run_tld -p ../parameters.yml -s ../datasets/06_car/car.mpg
%To init bounding box from file
./run_tld -p ../parameters.yml -s ../datasets/06_car/car.mpg -b ../datasets/06_car/init.txt
%To train only in the first frame (no tracking, no learning)
./run_tld -p ../parameters.yml -s ../datasets/06_car/car.mpg -b ../datasets/06_car/init.txt -no_tl
%To test the final detector (Repeat the video, first time learns, second time detects)
./run_tld -p ../parameters.yml -s ../datasets/06_car/car.mpg -b ../datasets/06_car/init.txt -r
*/
//感觉就是对起始帧进行初始化工作,然后逐帧读入图片序列,进行算法处理。
int main(int argc, char * argv[]){
VideoCapture capture;
capture.open(0);
//OpenCV的C++接口中,用于保存图像的imwrite只能保存整数数据,且需作为图像格式。当需要保存浮
//点数据或XML/YML文件时,OpenCV的C语言接口提供了cvSave函数,但这一函数在C++接口中已经被删除。
//取而代之的是FileStorage类。