covHolder.H
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049 #ifndef COVHOLDER_H_DEFINED
00050 #define COVHOLDER_H_DEFINED
00051
00052 #include "VFAT/targetInfo.H"
00053
00054 #include <fstream>
00055 #include <iostream>
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070 template <class FLOAT> class covHolder : public vfatTargetInfo<FLOAT>
00071 {
00072 public:
00073 inline covHolder();
00074 inline ~covHolder();
00075
00076 inline void resize(unsigned long _dim, unsigned long _samples,
00077 FLOAT initVal);
00078
00079 inline void dumpMeToFile(std::string myname, std::string frame, bool init);
00080
00081 bool isMatched;
00082
00083 bool isLarge;
00084
00085 unsigned long samples;
00086
00087 unsigned long sortID;
00088
00089 unsigned long matchID;
00090
00091 std::vector<std::vector<FLOAT> > meanTheta;
00092
00093 std::vector<std::vector<FLOAT> > meanRatio;
00094 };
00095
00096
00097 template <class FLOAT>
00098 inline covHolder<FLOAT>::covHolder() : vfatTargetInfo<FLOAT>()
00099 {}
00100
00101
00102 template <class FLOAT>
00103 inline covHolder<FLOAT>::~covHolder()
00104 {}
00105
00106
00107 template <class FLOAT>
00108 inline void covHolder<FLOAT>::resize(unsigned long _dim,
00109 unsigned long _samples,
00110 FLOAT initVal)
00111 {
00112 std::cerr << "COVHOLDER RESET\n";
00113 samples = _samples;
00114 vfatTargetInfo<FLOAT>::dim = _dim;
00115 std::string foo = "foo";
00116 std::vector<FLOAT> tempTD(vfatTargetInfo<FLOAT>::dim,initVal);
00117 meanRatio.resize(vfatTargetInfo<FLOAT>::dim,tempTD);
00118 meanTheta.resize(vfatTargetInfo<FLOAT>::dim,tempTD);
00119 vfatTargetInfo<FLOAT>::featureName.resize(vfatTargetInfo<FLOAT>::dim,foo);
00120 vfatTargetInfo<FLOAT>::resize(_dim);
00121 }
00122
00123 template <class FLOAT>
00124 inline void covHolder<FLOAT>::dumpMeToFile(std::string myname,
00125 std::string frame,
00126 bool init)
00127 {
00128 std::string newFile;
00129 std::string newFile2;
00130 newFile = myname + ".out.covHolder.S.Sig";
00131 newFile2 = myname + ".out.covHolder.F.Sig";
00132 LINFO("DUMPING COVMATRIX TO %s",newFile.c_str());
00133
00134 if(init)
00135 {
00136 std::ofstream outfile(newFile.c_str(),std::ios::out);
00137 outfile << "**************************************************\n";
00138 outfile << "Note: color values are normalized between 0 and 1\n";
00139 outfile << "FRAME"
00140 << "\tBaseID" << "\tSortID"
00141 << "\tMatchID" << "\tSamples"
00142 << "\tDiminsions" << "\tLifeSpan"
00143 << "\tPositionX" << "\tPositionY"
00144 << "\tMinX" << "\tMaxX"
00145 << "\tMinY" << "\tMaxY\n";
00146 outfile.close();
00147 }
00148
00149 std::ofstream outfile(newFile.c_str(),std::ios::app);
00150 outfile << frame
00151 << "\t" << vfatTargetInfo<FLOAT>::baseID
00152 << "\t" << sortID
00153 << "\t" << matchID << "\t" << samples
00154 << "\t" << vfatTargetInfo<FLOAT>::dim
00155 << "\t" << vfatTargetInfo<FLOAT>::lifeSpan
00156 << "\t" << vfatTargetInfo<FLOAT>::posX
00157 << "\t" << vfatTargetInfo<FLOAT>::posY
00158 << "\t" << vfatTargetInfo<FLOAT>::minX
00159 << "\t" << vfatTargetInfo<FLOAT>::maxX
00160 << "\t" << vfatTargetInfo<FLOAT>::minY
00161 << "\t" << vfatTargetInfo<FLOAT>::maxY << "\n";
00162 outfile.close();
00163
00164 if(init)
00165 {
00166 std::ofstream outfile2(newFile2.c_str(),std::ios::out);
00167 outfile << "Note: feature value = bias*(norm*(value + trans))\n";
00168 outfile << "Also: Spatial norm = 1/image size\n\n";
00169
00170 outfile2 << "FRAME\t" << "BaseID\t" << "MatchID";
00171 for(unsigned long x = 0; x < vfatTargetInfo<FLOAT>::dim; x++)
00172 {
00173 outfile2 << "\tFEATURE"
00174 << "\tMean"
00175 << "\tStandardDev"
00176 << "\tMinValue"
00177 << "\tMaxValue"
00178 << "\tEigenVal"
00179 << "\tSpeed" << "\tSpeedAvg"
00180 << "\tAccel" << "\tAccelAvg"
00181 << "\tDistance"
00182 << "\tBias"
00183 << "\tNorm"
00184 << "\tTranslate";
00185 }
00186 outfile2 << "\n";
00187 outfile2.close();
00188 }
00189
00190 std::ofstream outfile2(newFile2.c_str(),std::ios::app);
00191 outfile2 << frame << "\t" << vfatTargetInfo<FLOAT>::baseID << "\t"
00192 << matchID;
00193 for(unsigned long x = 0; x < vfatTargetInfo<FLOAT>::dim; x++)
00194 {
00195 outfile2 << "\t" << vfatTargetInfo<FLOAT>::featureName[x]
00196 << "\t" << vfatTargetInfo<FLOAT>::mean[x]
00197 << "\t" << vfatTargetInfo<FLOAT>::STD[x]
00198 << "\t" << vfatTargetInfo<FLOAT>::min[x]
00199 << "\t" << vfatTargetInfo<FLOAT>::max[x]
00200 << "\t" << vfatTargetInfo<FLOAT>::eigenVal[x]
00201 << "\t" << vfatTargetInfo<FLOAT>::speed[x]
00202 << "\t" << vfatTargetInfo<FLOAT>::avgspeed[x]
00203 << "\t" << vfatTargetInfo<FLOAT>::accel[x]
00204 << "\t" << vfatTargetInfo<FLOAT>::avgaccel[x]
00205 << "\t" << vfatTargetInfo<FLOAT>::distance[x]
00206 << "\t" << vfatTargetInfo<FLOAT>::bias[x]
00207 << "\t" << vfatTargetInfo<FLOAT>::norm[x]
00208 << "\t" << vfatTargetInfo<FLOAT>::trans[x];
00209 }
00210 outfile2 << "\n";
00211 outfile2.close();
00212
00213
00214
00215
00216
00217
00218
00219
00220
00221
00222
00223
00224
00225
00226
00227
00228
00229
00230
00231
00232
00233 outfile.close();
00234 LINFO("DONE");
00235 }
00236
00237 #endif