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

void Impala::Application::Util::DoConcepts2TrecResult (  ) 

Definition at line 1735 of file mainUtil.cpp.

References Impala::CmdOptions::GetArg(), Impala::Core::VideoSet::Keyframes::GetFrameId(), Impala::CmdOptions::GetInstance(), Impala::Core::Database::RawDataSet::GetLocator(), Impala::Core::VideoSet::Segmentation::GetName(), Impala::CmdOptions::GetNrArg(), Impala::Core::VideoSet::Segmentation::GetShotId(), Impala::Core::VideoSet::Keyframes::GetShotId(), ILOG_ERROR, ILOG_INFO, ILOG_VAR, Impala::Core::VideoSet::MakeVideoSet(), Impala::QUID_CLASS_FRAME, Impala::QUID_CLASS_SHOT, Impala::QuidClass(), Impala::Persistency::RepositoryGetFile(), and Impala::Persistency::File::WriteStrings().

Referenced by mainUtil().

01736 {
01737     typedef Core::VideoSet::VideoSet VideoSet;
01738     typedef Core::VideoSet::Segmentation Segmentation;
01739     typedef Core::VideoSet::Keyframes Keyframes;
01740     typedef Core::Table::SimilarityTableSet SimilarityTableSet;
01741     typedef Core::Table::SimilarityTableSet::RankTableType RankTableType;
01742 
01743     ILOG_VAR(Impala.Application.Util.DoConcepts2TrecResult);
01744     CmdOptions& options = CmdOptions::GetInstance();
01745     if (options.GetNrArg() < 5)
01746     {
01747         ILOG_ERROR("Need more parameters");
01748         return;
01749     }
01750     String vidSetName = options.GetArg(1);
01751     String conceptSet = options.GetArg(2);
01752     String model = options.GetArg(3);
01753     String feature = options.GetArg(4);
01754 
01755     VideoSet* vidSet = Core::VideoSet::MakeVideoSet(vidSetName);
01756     SegmentationLocator sLoc(vidSetName, "segmentation", options);
01757     Segmentation* segmentation = SegmentationRepository().Get(sLoc, vidSet);
01758     KeyframesLocator kLoc(vidSetName, "keyframes", options);
01759     Keyframes* keyframes = KeyframesRepository().Get(kLoc, vidSet);
01760     SimilarityTableSetLocator simLoc(vidSet->GetLocator(), true, "",
01761                                      conceptSet, model, feature, "");
01762     SimilarityTableSet* simSet = SimilarityTableSetRepository().Get(simLoc);
01763 
01764     for (int c=0 ; c<simSet->NrTables() ; c++)
01765     {
01766         String concept = simSet->GetName(c);
01767         ILOG_INFO("Doing concept " << concept);
01768         std::vector<String> res;
01769         RankTableType* rTable = simSet->GetRankTable(c);
01770         for (int i=0 ; i<rTable->Size() ; i++)
01771         {
01772             Quid quid = rTable->Get1(i);
01773             int shot = -1;
01774             if (QuidClass(quid) == QUID_CLASS_FRAME) // assume it is a keyframe
01775             {
01776                 int keyfr = keyframes->GetFrameId(quid);
01777                 if (keyfr != -1)
01778                     shot = keyframes->GetShotId(keyfr);
01779             }
01780             if (QuidClass(quid) == QUID_CLASS_SHOT)
01781             {
01782                 shot = segmentation->GetShotId(quid);
01783             }
01784             if (shot == -1)
01785             {
01786                 ILOG_ERROR("Unable to find shot for " << QuidObj(quid));
01787                 continue;
01788             }
01789             String name = segmentation->GetName(shot);
01790             if (std::find(res.begin(), res.end(), name) == res.end())
01791                 res.push_back(name);
01792         }
01793         String fName = concept + ".txt";
01794         Persistency::File file = RepositoryGetFile(fName, true, false);
01795         file.WriteStrings(res.begin(), res.end());
01796     }
01797     delete simSet;
01798     delete vidSet;
01799 }

Here is the call graph for this function:


Generated on Thu Jan 13 09:16:30 2011 for ImpalaSrc by  doxygen 1.5.1