Definition at line 1113 of file mainTable.cpp. References Impala::atol(), Impala::Core::Table::Copy(), Impala::Core::Array::Dilation(), Impala::Core::Training::Equals(), Impala::Core::Array::Erosion(), Impala::FileNameBase(), Impala::FileNameExt(), Impala::CmdOptions::GetArg(), Impala::CmdOptions::GetInstance(), Impala::CmdOptions::GetNrArg(), ILOG_ERROR, ILOG_VAR, Impala::Core::Table::SimilarityTableSet::MakeFromFile(), Impala::Core::VideoSet::MakeVideoSet(), Impala::Core::Matrix::MatSet(), Impala::Core::Array::Mul(), Impala::Core::Array::Percentile(), and Impala::Core::Array::Set(). Referenced by mainTable(). 01114 { 01115 typedef Core::Table::SimilarityTableSet SimilarityTableSet; 01116 typedef Core::Table::SimilarityTableSet::SimTableType SimTableType; 01117 typedef Core::Table::SimilarityTableSet::RankTableType RankTableType; 01118 typedef Core::Array::Array2dScalarReal64 ArrayType; 01119 01120 ILOG_VAR(Impala.Application.Table.DoProcSimilarityTableSet); 01121 CmdOptions& options = CmdOptions::GetInstance(); 01122 if (options.GetNrArg() < 7) 01123 { 01124 ILOG_ERROR("Need more parameters"); 01125 return; 01126 } 01127 01128 String setName = options.GetArg(1); 01129 Core::VideoSet::VideoSet* vidSet = Core::VideoSet::MakeVideoSet(setName); 01130 String walkType = options.GetArg(2); 01131 String conceptSet = options.GetArg(3); 01132 String model = options.GetArg(4); 01133 String feature = options.GetArg(5); 01134 int fileId = Impala::atol(options.GetArg(6)); 01135 01136 SimilarityTableSet* srcSet = Core::Table::SimilarityTableSet::MakeFromFile 01137 (vidSet, walkType, conceptSet, model, feature, fileId); 01138 //String fName2 = options.GetArg(2); 01139 01140 std::vector<String> srcNames = srcSet->GetNames(); 01141 std::vector<String> dstNames; 01142 for (int i=0 ; i<srcNames.size() ; i++) 01143 { 01144 dstNames.push_back(srcNames[i]); 01145 dstNames.push_back(srcNames[i] + "_proc"); 01146 } 01147 SimilarityTableSet* dstSet = 01148 new SimilarityTableSet(dstNames, srcSet->TableSize()); 01149 01150 01151 Core::Table::Copy(dstSet->GetQuidTable(), srcSet->GetQuidTable()); 01152 for (int t=0 ; t<srcSet->NrTables() ; t++) 01153 { 01154 SimTableType* srcTable = srcSet->GetSimTable(t); 01155 Core::Table::Copy(dstSet->GetSimTable(2*t), srcTable); 01156 01157 SimTableType* dstTable = dstSet->GetSimTable(2*t+1); 01158 Core::Table::Copy(dstTable, srcTable); 01159 ArrayType srcWrap(srcTable->Size(), 1, 0, 0, 01160 srcTable->GetColumn1()->GetData(), true); 01161 ArrayType* tmp = 0; 01162 01163 //Core::Array::Percentile(tmp, &srcWrap, 15, 0.8); 01164 01165 Core::Array::Percentile(tmp, &srcWrap, 5, 0.5); 01166 ArrayType* ker = Core::Array::ArrayCreate<ArrayType>(101, 1); 01167 Core::Matrix::MatSet(ker, 0); 01168 Core::Array::Erosion(tmp, tmp, ker); 01169 Core::Array::Dilation(tmp, tmp, ker); 01170 delete ker; 01171 01172 Real64* tmpPtr = tmp->CPB(0, 0); 01173 for (int i=tmp->CW()-1 ; i>=1 ; i--) 01174 { 01175 if (tmpPtr[i] == tmpPtr[i-1]) 01176 tmpPtr[i] = 0; 01177 } 01178 01179 ker = Core::Array::ArrayCreate<ArrayType>(501, 1); 01180 Core::Matrix::MatSet(ker, 0); 01181 ArrayType* localMax = 0; 01182 Core::Array::Dilation(localMax, tmp, ker); 01183 Core::Array::Equals(localMax, localMax, tmp); 01184 Core::Array::Mul(tmp, localMax, tmp); 01185 delete ker; 01186 delete localMax; 01187 01188 ArrayType* dstWrap = new ArrayType(dstTable->Size(), 1, 0, 0, 01189 dstTable->GetColumn1()->GetData(), true); 01190 Core::Array::Set(dstWrap, tmp); 01191 delete dstWrap; 01192 delete tmp; 01193 01194 } 01195 dstSet->ComputeRanks(true); 01196 String con = FileNameBase(conceptSet) + "_proc." + FileNameExt(conceptSet); 01197 dstSet->Save(vidSet, walkType, con, model, feature, fileId, true); 01198 }
Here is the call graph for this function:
|