Home || Architecture || Video Search || Visual Search || Scripts || Applications || Important Messages || OGL || Src

void Impala::Application::Table::DoSelectFeatureTableSet (  ) 

Definition at line 673 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().

00674 {
00675     typedef Core::Feature::FeatureTableSet FeatureTableSet;
00676     typedef Core::Feature::FeatureTable FeatureTable;
00677 
00678     ILOG_VAR(Impala.Application.Table.DoSelectFeatureTableSet);
00679     CmdOptions& options = CmdOptions::GetInstance();
00680     if (options.GetNrArg() < 5)
00681     {
00682         ILOG_ERROR("Need more parameters");
00683         return;
00684     }
00685 
00686     String setName = options.GetArg(1);
00687     String resName = options.GetArg(2);
00688     int optimalSize = atol(options.GetArg(3));
00689     String feature = options.GetArg(4);
00690     Core::Database::RawDataSet* ds = Core::Database::MakeRawDataSet(setName);
00691 
00692     Core::Feature::Computor* c = 0;
00693     if (feature == "weibull")
00694         c = new Core::Feature::VisSem("vissem", options);
00695     else if (feature == "gabor")
00696         c = new Core::Feature::VisSem("vissemgabor", options);
00697     else
00698         ILOG_ERROR("unknown feature : " << feature);
00699     c->ReadPrototypes(setName, "", -1);
00700 
00701     std::vector<String> res;
00702     std::vector<int> resVal;
00703     for (int p=0 ; p<c->GetNrPixelFeatureSets() ; p++)
00704     {
00705         for (int r=0 ; r<c->GetNrRegionFeatureSets() ; r++)
00706         {
00707             std::cout << "p=" << p << " r=" << r << std::endl;
00708             std::vector<FeatureTable*> tabs = c->GetProtoFeatureTables(p, r);
00709             int bestIdx = -1;
00710             int bestVal = 0;
00711             for (int t=0 ; t<tabs.size() ; t++)
00712             {
00713                 FeatureTable* tab = tabs[t];
00714                 std::cout << "  " << tab->GetFeatureDefinition().AsString()
00715                           << " = " << tab->Size() << std::endl;
00716                 int s = tab->Size();
00717                 if (bestIdx == -1)
00718                 {
00719                     bestIdx = t;
00720                     bestVal = s;
00721                     continue;
00722                 }
00723                 if (s >= optimalSize)
00724                 {
00725                     if ((bestVal < optimalSize) || (s < bestVal))
00726                     {
00727                         bestIdx = t;
00728                         bestVal = s;
00729                     }
00730                 }
00731                 else
00732                 {
00733                     if ((bestVal < optimalSize) && (s > bestVal))
00734                     {
00735                         bestIdx = t;
00736                         bestVal = s;
00737                     }
00738                 }
00739             }
00740             std::cout << "    bestVal = " << bestVal << std::endl;
00741             String def = tabs[bestIdx]->GetFeatureDefinition().AsString();
00742             res.push_back(def);
00743             resVal.push_back(bestVal);
00744         }
00745     }
00746 
00747     std::cout << std::endl << "Selection: " << std::endl;
00748     for (int i=0 ; i<res.size() ; i++)
00749     {
00750         std::cout << resVal[i] << " from " << res[i] << std::endl;
00751     }
00752     String fName = ds->GetFilePathPrototype(c->GetProtoDataFile(), c->GetName(),
00753                                             resName, true, false);
00754     if (!fName.empty())
00755     {
00756         std::cout << "Writing to " << fName << std::endl;
00757         Util::DatabaseWriteString(fName, ds->GetDatabase(), res.begin(),
00758                                   res.end());
00759     }
00760 }

Here is the call graph for this function:


Generated on Fri Mar 19 10:51:00 2010 for ImpalaSrc by  doxygen 1.5.1