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

void Impala::Core::Trec::Collection::WriteVideoSet ( const Persistency::Locator loc,
String  use,
String  clipsKeys,
bool  vidSetOnly 
) [inline]

Definition at line 40 of file Collection.h.

References Impala::Core::Table::TableTem< Col1T, Col2T, Col3T, Col4T, Col5T, Col6T, Col7T, Col8T, Col9T >::Add(), Impala::Core::VideoSet::Mpeg7Doc::EndFrame(), Impala::Core::Stream::RgbDataSrc::FrameRateDen(), Impala::Core::Stream::RgbDataSrc::FrameRateNum(), Impala::Persistency::Locator::GetDataSet(), Impala::Core::VideoSet::Segmentation::GetEnd(), Impala::Core::VideoSet::Keyframes::GetFrameNr(), Impala::Util::Database::GetInstance(), Impala::Persistency::Locator::GetProtocolAndHost(), 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(), mFileName, mId, mSrcDir, mUse, Impala::Core::VideoSet::Mpeg7Doc::NrKeyframes(), Impala::Core::VideoSet::Mpeg7Doc::NrShots(), NrVideoFiles(), ReadKeyframesClips(), Impala::Core::VideoSet::Keyframes::RemoveDuplicates(), Impala::Persistency::Mpeg7DocLocator::SetFrameRateDen(), Impala::Persistency::Mpeg7DocLocator::SetFrameRateNum(), Impala::Core::Database::RawDataSet::SetProtocolAndHost(), 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().

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

Here is the call graph for this function:


Generated on Thu Jan 13 09:21:26 2011 for ImpalaSrc by  doxygen 1.5.1