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

void Impala::Core::Trec::Collection::WriteVideoSet ( String  setName,
String  use,
String  clipsKeys 
) [inline]

Definition at line 47 of file Collection.h.

References Impala::Core::Table::TableTem< Col1T, Col2T, Col3T, Col4T, Col5T, Col6T, Col7T, Col8T, Col9T >::Add(), Impala::Core::Database::RawDataSet::AddFile(), Impala::Core::VideoSet::Mpeg7Doc::EndFrame(), Impala::Core::VideoSet::Segmentation::GetEnd(), Impala::Core::VideoSet::Keyframes::GetFrameNr(), Impala::Core::Database::RawDataSet::GetLocator(), Impala::Core::VideoSet::Keyframes::GetShotId(), Impala::Core::VideoSet::Segmentation::GetStart(), ILOG_ERROR, ILOG_INFO, Impala::Core::VideoSet::Mpeg7Doc::KeyframeFrame(), Impala::Core::VideoSet::Mpeg7Doc::KeyframeName(), Impala::MakeString(), mDb, mFileName, mId, mSrcDir, mUse, Impala::Core::VideoSet::Mpeg7Doc::NrKeyframes(), Impala::Core::VideoSet::Mpeg7Doc::NrShots(), NrVideoFiles(), ReadKeyframesClips(), Impala::Core::VideoSet::Keyframes::RemoveDuplicates(), Impala::Core::VideoSet::Keyframes::Save(), Impala::Core::VideoSet::Segmentation::Save(), Impala::Core::VideoSet::VideoSet::SaveVideoSet(), Impala::Core::VideoSet::Mpeg7Doc::ShotName(), Impala::Core::Table::Table::Size(), Impala::Core::VideoSet::Mpeg7Doc::StartFrame(), and Impala::Core::VideoSet::Keyframes::WriteImageSets().

Referenced by Impala::Application::Util::DoTrecSet().

00048     {
00049 #ifndef REPOSITORY_USED // Here comes the deprecated stuff
00050         VideoSet::VideoSet* vidSet = new VideoSet::VideoSet(mDb, setName, false);
00051 #else // REPOSITORY_USED
00052         VideoSet::VideoSet* vidSet = new VideoSet::VideoSet(setName);
00053 #endif // REPOSITORY_USED
00054         Segmentation segm(vidSet, "");
00055         Keyframes keyframes(vidSet, "");
00056         int videoId = 0;
00057         int offset = 0; // hack to skip devel video's in test keyframelist
00058         for (int v=0 ; v<NrVideoFiles() ; v++)
00059         {
00060             if ((!use.empty()) && (mUse[v] != use))
00061             {
00062                 if (use == "test")
00063                     offset = v + 1;
00064                 continue;
00065             }
00066 
00067             vidSet->AddFile(mFileName[v], ".", ".");
00068 
00069 #ifndef REPOSITORY_USED // Here comes the deprecated stuff
00070             Mpeg7Doc mp7doc(mSrcDir + MakeString(mId[v]) + ".mp7.xml", mDb);
00071             Mpeg7Doc* mp7 = &mp7doc;
00072 #else // REPOSITORY_USED
00073             String fileName = mSrcDir + MakeString(mId[v]) + ".mp7.xml";
00074             Persistency::Mpeg7DocLocator loc(fileName);
00075             std::cout << "loc = " << loc << std::endl;
00076             Mpeg7Doc* mp7 = Persistency::Mpeg7DocRepository().Get(loc);
00077 #endif // REPOSITORY_USED
00078             ILOG_INFO("video " << mFileName[v] << " shots " << mp7->NrShots());
00079             int lastFrame = 0;
00080             for (int s=0 ; s<mp7->NrShots() ; s++)
00081             {
00082                 if (mp7->StartFrame(s) != lastFrame)
00083                 {
00084                     ILOG_ERROR("shot " << s << " has gap (previous shot end "
00085                                << lastFrame << ", this shot start " <<
00086                                mp7->StartFrame(s) << "), adjusting start");
00087                     segm.Add(videoId, lastFrame, mp7->EndFrame(s),
00088                              mp7->ShotName(s));
00089                 }
00090                 else
00091                 {
00092                     segm.Add(videoId, mp7->StartFrame(s), mp7->EndFrame(s),
00093                              mp7->ShotName(s));
00094                 }
00095                 lastFrame = mp7->EndFrame(s) + 1;
00096                 if (clipsKeys.empty())
00097                 {
00098                     int shotId = segm.Size() - 1;
00099                     for (int k=0 ; k<mp7->NrKeyframes(s) ; k++)
00100                     {
00101                         String name = mp7->KeyframeName(s, k) + ".jpg";
00102                         keyframes.Add(videoId, shotId, mp7->KeyframeFrame(s, k),
00103                                       name);
00104                     }
00105                 }
00106             }
00107 #ifndef REPOSITORY_USED // Here comes the deprecated stuff
00108 #else // REPOSITORY_USED
00109             delete mp7;
00110 #endif // REPOSITORY_USED
00111             videoId++;
00112         }
00113         if (!clipsKeys.empty())
00114             ReadKeyframesClips(&segm, &keyframes, clipsKeys, offset);
00115 #ifndef REPOSITORY_USED // Here comes the deprecated stuff
00116         vidSet->SaveVideoSet();
00117         bool binary = true;
00118         segm.Save("segmentation", binary);
00119 #else // REPOSITORY_USED
00120         Persistency::Locator baseLoc = vidSet->GetLocator();
00121         bool binary = true;
00122         Persistency::VideoSetRepository().Add(baseLoc, vidSet);
00123         Persistency::SegmentationLocator sLoc(baseLoc, "segmentation");
00124         Persistency::SegmentationRepository().Add(sLoc, &segm);
00125 #endif // REPOSITORY_USED
00126 
00127         keyframes.RemoveDuplicates();
00128         for (int i=0 ; i<keyframes.Size() ; i++)
00129         {
00130             int frame = keyframes.GetFrameNr(i);
00131             int shotId = keyframes.GetShotId(i);
00132             int start = segm.GetStart(shotId);
00133             int end = segm.GetEnd(shotId);
00134             if ((frame < start) || (frame > end))
00135             {
00136                 ILOG_ERROR("keyframe " << i << ": frame " << frame <<
00137                            " outside shot " << start << " - " << end);
00138             }
00139         }   
00140 #ifndef REPOSITORY_USED // Here comes the deprecated stuff
00141         keyframes.Save("keyframes", binary);
00142 #else // REPOSITORY_USED
00143         Persistency::KeyframesLocator kLoc(baseLoc, "keyframes");
00144         Persistency::KeyframesRepository().Add(kLoc, &keyframes);
00145 #endif // REPOSITORY_USED
00146         keyframes.WriteImageSets();
00147     }

Here is the call graph for this function:


Generated on Fri Mar 19 11:25:26 2010 for ImpalaSrc by  doxygen 1.5.1