Definition at line 1301 of file mainUtil.cpp. References Impala::Util::DatabaseWriteString(), Impala::CmdOptions::GetArg(), Impala::Core::Database::RawDataSet::GetDatabase(), Impala::Core::VideoSet::Keyframes::GetFrameId(), Impala::CmdOptions::GetInstance(), 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::Table::SimilarityTableSet::MakeFromFile(), Impala::Core::VideoSet::MakeVideoSet(), Impala::QUID_CLASS_FRAME, Impala::QUID_CLASS_SHOT, and Impala::QuidClass(). Referenced by mainUtil(). 01302 { 01303 #ifndef REPOSITORY_TODO 01304 typedef Core::VideoSet::VideoSet VideoSet; 01305 typedef Core::VideoSet::Segmentation Segmentation; 01306 typedef Core::VideoSet::Keyframes Keyframes; 01307 typedef Core::Table::SimilarityTableSet SimilarityTableSet; 01308 typedef Core::Table::SimilarityTableSet::RankTableType RankTableType; 01309 01310 ILOG_VAR(Impala.Application.Util.DoConcepts2TrecResult); 01311 CmdOptions& options = CmdOptions::GetInstance(); 01312 if (options.GetNrArg() < 3) 01313 { 01314 ILOG_ERROR("Need more parameters"); 01315 return; 01316 } 01317 String vidSetName = options.GetArg(1); 01318 String namesPath = options.GetArg(2); 01319 01320 VideoSet* vidSet = Core::VideoSet::MakeVideoSet(vidSetName); 01321 SegmentationLocator sLoc(vidSetName, "segmentation", options); 01322 Segmentation* segmentation = SegmentationRepository().Get(sLoc, vidSet); 01323 KeyframesLocator kLoc(vidSetName, "keyframes", options); 01324 Keyframes* keyframes = KeyframesRepository().Get(kLoc, vidSet); 01325 Impala::Util::Database* db = vidSet->GetDatabase(); 01326 SimilarityTableSet* simSet = 01327 Core::Table::SimilarityTableSet::MakeFromFile(namesPath, db); 01328 01329 for (int c=0 ; c<simSet->NrTables() ; c++) 01330 { 01331 String concept = simSet->GetName(c); 01332 ILOG_INFO("Doing concept " << concept); 01333 std::vector<String> res; 01334 RankTableType* rTable = simSet->GetRankTable(c); 01335 for (int i=0 ; i<rTable->Size() ; i++) 01336 { 01337 Quid quid = rTable->Get1(i); 01338 int shot = -1; 01339 if (QuidClass(quid) == QUID_CLASS_FRAME) // assume it is a keyframe 01340 { 01341 int keyfr = keyframes->GetFrameId(quid); 01342 if (keyfr != -1) 01343 shot = keyframes->GetShotId(keyfr); 01344 } 01345 if (QuidClass(quid) == QUID_CLASS_SHOT) 01346 { 01347 shot = segmentation->GetShotId(quid); 01348 } 01349 if (shot == -1) 01350 { 01351 ILOG_ERROR("Unable to find shot for " << QuidObj(quid)); 01352 continue; 01353 } 01354 String name = segmentation->GetName(shot); 01355 if (std::find(res.begin(), res.end(), name) == res.end()) 01356 res.push_back(name); 01357 } 01358 String fName = concept + ".txt"; 01359 Impala::Util::DatabaseWriteString(fName, db, res.begin(), res.end()); 01360 } 01361 delete simSet; 01362 delete vidSet; 01363 #endif 01364 }
Here is the call graph for this function:
|