Definition at line 375 of file mainTable.cpp. References Impala::Core::Vector::DivAssign(), Impala::FileExists(), Impala::FileNamePath(), Impala::Core::Table::TableTem< Col1T, Col2T, Col3T, Col4T, Col5T, Col6T, Col7T, Col8T, Col9T >::Get1(), Impala::Core::Table::TableTem< Col1T, Col2T, Col3T, Col4T, Col5T, Col6T, Col7T, Col8T, Col9T >::Get2(), Impala::CmdOptions::GetArg(), Impala::Core::Table::TableTem< Col1T, Col2T, Col3T, Col4T, Col5T, Col6T, Col7T, Col8T, Col9T >::GetColumn2(), Impala::Core::Database::RawDataSet::GetDatabase(), Impala::Core::Feature::FeatureTable::GetFeatureDefinition(), Impala::Core::Feature::FeatureTable::GetFeatureVectorLength(), Impala::Util::Database::GetInstance(), Impala::CmdOptions::GetInstance(), Impala::CmdOptions::GetString(), Impala::Util::Database::MakeDir(), Impala::Core::ImageSet::MakeImageSet(), Impala::Core::VideoSet::MakeVideoSet(), Impala::Core::Vector::Max(), Impala::Core::Vector::Min(), Impala::Core::Table::Read(), Impala::Core::Table::Table::Size(), Impala::Core::Vector::SubAssign(), and Impala::Core::Table::Write(). Referenced by mainTable(). 00376 { 00377 typedef Core::Feature::FeatureTable FeatureTable; 00378 typedef Core::Vector::VectorTem<Real64> VectorReal64; 00379 00380 CmdOptions& options = CmdOptions::GetInstance(); 00381 String tablename = options.GetArg(1); 00382 String scaledtablename = options.GetArg(2); 00383 String minmaxtablename = options.GetArg(3); 00384 00385 Core::Database::RawDataSet* dataSet = 0; 00386 String setName = options.GetString("videoSet"); 00387 if (! setName.empty()) 00388 dataSet = Core::VideoSet::MakeVideoSet(setName); 00389 setName = options.GetString("imageSet"); 00390 if (! setName.empty()) 00391 dataSet = Core::ImageSet::MakeImageSet(setName); 00392 Util::Database* db = &Util::Database::GetInstance(); 00393 if (dataSet) 00394 db = dataSet->GetDatabase(); 00395 00396 FeatureTable tableIn(tablename); 00397 Core::Table::Read(&tableIn, tablename, db); 00398 00399 // FeatureTable tableMinMax(tableIn.GetFeatureDefinition()); 00400 FeatureTable tableMinMax(tableIn.GetFeatureDefinition(), 2, tableIn.GetFeatureVectorLength()); 00401 FeatureTable tableOut(tableIn.GetFeatureDefinition(), tableIn.Size(), tableIn.GetFeatureVectorLength()); 00402 00403 VectorReal64 vMax; 00404 VectorReal64 vMin; 00405 00406 if(FileExists(minmaxtablename)) 00407 { 00408 // read minmax from file 00409 std::cout << "read minmax from file: " << minmaxtablename << std::endl; 00410 Core::Table::Read(&tableMinMax, minmaxtablename, db); 00411 vMax = tableMinMax.Get2(0); 00412 vMin = tableMinMax.Get2(1); 00413 } 00414 else 00415 { 00416 // create minmax 00417 Core::Vector::Max(&vMax, tableIn.GetColumn2(), tableIn.Size(), 0); 00418 tableMinMax.Add(0, vMax); 00419 00420 Core::Vector::Min(&vMin, tableIn.GetColumn2(), tableIn.Size(), 0); 00421 tableMinMax.Add(1, vMin); 00422 00423 std::cout << "write minmax to file: " << minmaxtablename << std::endl; 00424 Core::Table::Write(&tableMinMax, minmaxtablename, db, true); 00425 } 00426 00427 std::cout << "max: " << vMax << std::endl; 00428 std::cout << "min: " << vMin << std::endl; 00429 //FeatureTable tableOut(tableIn); 00430 00431 VectorReal64 vMaxMinMin = vMax; 00432 Core::Vector::SubAssign(vMaxMinMin,vMin); 00433 //std::cout << "vMaxMinMin: " << vMaxMinMin << std::endl; 00434 00435 VectorReal64 v; 00436 for(int i=0;i<tableIn.Size();i++) 00437 { 00438 v = tableIn.Get2(i); 00439 Core::Vector::SubAssign(v, vMin); 00440 Core::Vector::DivAssign(v, vMaxMinMin); 00441 tableOut.Add(tableIn.Get1(i), v); 00442 } 00443 00444 // create dir if neccecary 00445 std::string path = FileNamePath(scaledtablename); 00446 db->MakeDir(path); 00447 //table.Dump(dataSet, options.GetInt("start"), options.GetInt("end")); 00448 Core::Table::Write(&tableOut, scaledtablename, db, true); 00449 }
Here is the call graph for this function:
|