00001 #ifndef Impala_Core_VideoSet_MakeSegmentationDocument_h
00002 #define Impala_Core_VideoSet_MakeSegmentationDocument_h
00003
00004 #include "Persistency/SegmentationRepository.h"
00005 #include "Persistency/KeyframesRepository.h"
00006 #include "Basis/CmdOptions.h"
00007 #include "Core/Table/SimilarityTableSet.h"
00008 #include "Core/ImageSet/MakeImageSet.h"
00009 #include "Core/VideoSet/MakeVideoSet.h"
00010 #include "Core/VideoSet/SegmentationDocument.h"
00011
00012 namespace Impala
00013 {
00014 namespace Core
00015 {
00016 namespace VideoSet
00017 {
00018
00019
00020 inline SegmentationDocument*
00021 MakeSegmentationDocument(String videoSetName)
00022 {
00023 typedef Core::ImageSet::ImageSet ImageSet;
00024 ILOG_VAR(Core.VideoSet.MakeSegmentationDocument);
00025 CmdOptions& options = CmdOptions::GetInstance();
00026
00027 ILOG_INFO("reading videoset");
00028 VideoSet* vidSet = MakeVideoSet(videoSetName);
00029 #ifndef REPOSITORY_USED // Here comes the deprecated stuff
00030 Util::Database* db = vidSet->GetDatabase();
00031
00032 ImageSet* imSetKeyfr =
00033 Core::ImageSet::MakeImageSet(options.GetString("imageSetKeyframes"),db);
00034 #else // REPOSITORY_USED
00035 String setName = options.GetString("imageSetKeyframes");
00036 ImageSet* imSetKeyfr = 0;
00037 if (!setName.empty())
00038 imSetKeyfr = Core::ImageSet::MakeImageSet(setName, vidSet->GetLocator());
00039 #endif // REPOSITORY_USED
00040 if (imSetKeyfr)
00041 {
00042 imSetKeyfr->SetImageSrc(false, false, true);
00043 }
00044 else
00045 {
00046 ILOG_INFO("No keyframes available");
00047 }
00048
00049 ILOG_INFO("Reading thumbnails");
00050 #ifndef REPOSITORY_USED // Here comes the deprecated stuff
00051 ImageSet* imSetThumb =
00052 Core::ImageSet::MakeImageSet(options.GetString("imageSetThumbnails"),db);
00053 #else // REPOSITORY_USED
00054 setName = options.GetString("imageSetThumbnails");
00055 ImageSet* imSetThumb = 0;
00056 if (!setName.empty())
00057 imSetThumb = Core::ImageSet::MakeImageSet(setName, vidSet->GetLocator());
00058 #endif // REPOSITORY_USED
00059 if (imSetThumb)
00060 {
00061 imSetThumb->SetImageSrc(! options.GetBool("noArchive"),
00062 options.GetBool("imFileArchive"),
00063 options.GetBool("imSplitArchive"),
00064 true);
00065 }
00066 else
00067 {
00068 ILOG_INFO("No thumbnails available");
00069 }
00070
00071 ILOG_INFO("Reading stills");
00072 #ifndef REPOSITORY_USED // Here comes the deprecated stuff
00073 ImageSet* imSetStill =
00074 Core::ImageSet::MakeImageSet(options.GetString("imageSetStills"), db);
00075 #else // REPOSITORY_USED
00076 setName = options.GetString("imageSetStills");
00077 ImageSet* imSetStill = 0;
00078 if (!setName.empty())
00079 imSetStill = Core::ImageSet::MakeImageSet(setName, vidSet->GetLocator());
00080 #endif // REPOSITORY_USED
00081 if (imSetStill)
00082 {
00083 imSetStill->SetImageSrc(false, false, true);
00084 }
00085 else
00086 {
00087 ILOG_INFO("No stills available");
00088 }
00089
00090 #ifndef REPOSITORY_USED // Here comes the deprecated stuff
00091 ILOG_INFO("reading shots");
00092 Segmentation* shots = new Segmentation(vidSet, "segmentation");
00093
00094 ILOG_INFO("reading keyframe set");
00095 Keyframes* keyframes = new Keyframes(vidSet, "keyframes");
00096 #else // REPOSITORY_USED
00097 ILOG_INFO("reading shots");
00098 using namespace Impala::Persistency;
00099 SegmentationLocator segLoc(vidSet->GetLocator(), "segmentation");
00100 Segmentation* shots = SegmentationRepository().Get(segLoc, vidSet);
00101
00102 ILOG_INFO("reading keyframe set");
00103 KeyframesLocator keyLoc(vidSet->GetLocator(), "keyframes");
00104 Keyframes* keyframes = KeyframesRepository().Get(keyLoc, vidSet);
00105 #endif // REPOSITORY_USED
00106
00107 SegmentationDocument* segDoc = new SegmentationDocument
00108 (vidSet, shots, keyframes, imSetKeyfr, imSetThumb, imSetStill);
00109 return segDoc;
00110 }
00111
00112 }
00113 }
00114 }
00115
00116 #endif