Definition at line 373 of file mainTable.cpp. References Impala::atol(), Impala::Util::DatabaseWriteString(), Impala::CmdOptions::GetArg(), Impala::Core::Database::RawDataSet::GetDatabase(), Impala::Core::Database::RawDataSet::GetFilePathPrototype(), Impala::CmdOptions::GetInstance(), Impala::Core::Feature::Computor::GetName(), Impala::CmdOptions::GetNrArg(), Impala::Core::Feature::Computor::GetNrPixelFeatureSets(), Impala::Core::Feature::Computor::GetNrRegionFeatureSets(), Impala::Core::Feature::Computor::GetProtoDataFile(), Impala::Core::Feature::Computor::GetProtoFeatureTables(), ILOG_ERROR, ILOG_VAR, Impala::Core::Database::MakeRawDataSet(), and Impala::Core::Feature::Computor::ReadPrototypes(). Referenced by mainTable(). 00374 { 00375 typedef Core::Feature::FeatureTableSet FeatureTableSet; 00376 typedef Core::Feature::FeatureTable FeatureTable; 00377 00378 ILOG_VAR(Impala.Application.Table.DoSelectFeatureTableSet); 00379 CmdOptions& options = CmdOptions::GetInstance(); 00380 if (options.GetNrArg() < 5) 00381 { 00382 ILOG_ERROR("Need more parameters"); 00383 return; 00384 } 00385 00386 String setName = options.GetArg(1); 00387 String resName = options.GetArg(2); 00388 int optimalSize = atol(options.GetArg(3)); 00389 String feature = options.GetArg(4); 00390 Core::Database::RawDataSet* ds = Core::Database::MakeRawDataSet(setName); 00391 00392 Core::Feature::Computor* c = 0; 00393 if (feature == "weibull") 00394 c = new Core::Feature::VisSem("vissem", options); 00395 else if (feature == "gabor") 00396 c = new Core::Feature::VisSem("vissemgabor", options); 00397 else 00398 ILOG_ERROR("unknown feature : " << feature); 00399 c->ReadPrototypes(setName, "", -1); 00400 00401 std::vector<String> res; 00402 std::vector<int> resVal; 00403 for (int p=0 ; p<c->GetNrPixelFeatureSets() ; p++) 00404 { 00405 for (int r=0 ; r<c->GetNrRegionFeatureSets() ; r++) 00406 { 00407 std::cout << "p=" << p << " r=" << r << std::endl; 00408 std::vector<FeatureTable*> tabs = c->GetProtoFeatureTables(p, r); 00409 int bestIdx = -1; 00410 int bestVal = 0; 00411 for (int t=0 ; t<tabs.size() ; t++) 00412 { 00413 FeatureTable* tab = tabs[t]; 00414 std::cout << " " << tab->GetFeatureDefinition().AsString() 00415 << " = " << tab->Size() << std::endl; 00416 int s = tab->Size(); 00417 if (bestIdx == -1) 00418 { 00419 bestIdx = t; 00420 bestVal = s; 00421 continue; 00422 } 00423 if (s >= optimalSize) 00424 { 00425 if ((bestVal < optimalSize) || (s < bestVal)) 00426 { 00427 bestIdx = t; 00428 bestVal = s; 00429 } 00430 } 00431 else 00432 { 00433 if ((bestVal < optimalSize) && (s > bestVal)) 00434 { 00435 bestIdx = t; 00436 bestVal = s; 00437 } 00438 } 00439 } 00440 std::cout << " bestVal = " << bestVal << std::endl; 00441 String def = tabs[bestIdx]->GetFeatureDefinition().AsString(); 00442 res.push_back(def); 00443 resVal.push_back(bestVal); 00444 } 00445 } 00446 00447 std::cout << std::endl << "Selection: " << std::endl; 00448 for (int i=0 ; i<res.size() ; i++) 00449 { 00450 std::cout << resVal[i] << " from " << res[i] << std::endl; 00451 } 00452 String fName = ds->GetFilePathPrototype(c->GetProtoDataFile(), c->GetName(), 00453 resName, true, false); 00454 if (!fName.empty()) 00455 { 00456 std::cout << "Writing to " << fName << std::endl; 00457 Util::DatabaseWriteString(fName, ds->GetDatabase(), res.begin(), 00458 res.end()); 00459 } 00460 }
Here is the call graph for this function: ![]()
|