vidSeqSegmParams.cpp
00001
00008 #include <iostream>
00009 #include <fstream>
00010 #include <string>
00011 #include "opencv/cv.h"
00012 #include "opencv/cxcore.h"
00013 #include "opencv/highgui.h"
00014
00015 #include "options.h"
00016 #include "utils/libutils.h"
00017 #include "stats/libstats.h"
00018 #include "video/libvideo.h"
00019 #include "dytex/libdytex.h"
00020 #include "utils/configParser.hpp"
00021 #include "demos/vidSeqSegmParams.hpp"
00022
00023 using namespace cv;
00024 using namespace std;
00025
00026
00031 VidSeqSegmParams::VidSeqSegmParams()
00032 {
00033 totalvids=1;
00034 inputType=0;
00035 vidpath="../../testdata/vidsegm/ocean-fire-noborder/ocean-fire-noborder.y";
00036 trainvidnum=1;
00037 winxy=5;
00038 winz=5;
00039 stepxy=4;
00040 stepz=4;
00041 ntype=PatchOptions::NORM_ZM;
00042 bkvar=0;
00043 bkvarf=0;
00044 K=2;
00045 n=2;
00046 reg=50;
00047 nfrm=0;
00048 stepxy2=4;
00049 stepz2=4;
00050 filtxy=5;
00051 filtz=5;
00052 fsave=true;
00053 savepath="../../testdata/vidsegm/ocean-fire-noborder/";
00054 savename="rslt";
00055 }
00056
00062 void VidSeqSegmParams::updateFromFile(string fpath)
00063 {
00064 ConfigFile cfg(fpath);
00065
00066 if(cfg.keyExists("totalvids"))
00067 totalvids = cfg.getValueOfKey<int>("totalvids");
00068
00069 if(cfg.keyExists("trainvidnum"))
00070 trainvidnum = cfg.getValueOfKey<int>("trainvidnum");
00071
00072
00073 if(cfg.keyExists("savepath"))
00074 savepath = cfg.getValueOfKey<std::string>("savepath");
00075
00076 if(cfg.keyExists("savename"))
00077 savename = cfg.getValueOfKey<std::string>("savename");
00078
00079 if(cfg.keyExists("vidpath"))
00080 vidpath = cfg.getValueOfKey<std::string>("vidpath");
00081
00082 if(cfg.keyExists("winxy"))
00083 winxy = cfg.getValueOfKey<int>("winxy");
00084
00085 if(cfg.keyExists("winz"))
00086 winz = cfg.getValueOfKey<int>("winz");
00087
00088 if(cfg.keyExists("stepxy"))
00089 stepxy = cfg.getValueOfKey<int>("stepxy");
00090
00091 if(cfg.keyExists("stepz"))
00092 stepz = cfg.getValueOfKey<int>("stepz");
00093
00094 if(cfg.keyExists("ntype"))
00095 ntype = (PatchOptions::norm_type)cfg.getValueOfKey<int>("ntype");
00096
00097 if(cfg.keyExists("bkvar"))
00098 bkvar = cfg.getValueOfKey<double>("bkvar");
00099
00100 if(cfg.keyExists("bkvarf"))
00101 bkvarf = cfg.getValueOfKey<int>("bkvarf");
00102
00103 if(cfg.keyExists("K"))
00104 K = cfg.getValueOfKey<int>("K");
00105
00106 if(cfg.keyExists("n"))
00107 n = cfg.getValueOfKey<int>("n");
00108
00109 if(cfg.keyExists("reg"))
00110 reg = cfg.getValueOfKey<double>("reg");
00111
00112 if(cfg.keyExists("nfrm"))
00113 nfrm = cfg.getValueOfKey<int>("nfrm");
00114
00115 if(cfg.keyExists("stepxy2"))
00116 stepxy2 = cfg.getValueOfKey<int>("stepxy2");
00117
00118 if(cfg.keyExists("stepz2"))
00119 stepz2 = cfg.getValueOfKey<int>("stepz2");
00120
00121 if(cfg.keyExists("filtxy"))
00122 filtxy = cfg.getValueOfKey<int>("filtxy");
00123
00124 if(cfg.keyExists("filtz"))
00125 filtz = cfg.getValueOfKey<int>("filtz");
00126
00127 if(cfg.keyExists("fsave"))
00128 fsave = (bool)cfg.getValueOfKey<int>("fsave");
00129 }
00130