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 ImageSet* imSetKeyfr =
00036 Core::ImageSet::MakeImageSet(options.GetString("imageSetKeyframes"));
00037 #endif // REPOSITORY_USED
00038 if (imSetKeyfr)
00039 {
00040 imSetKeyfr->SetImageSrc(false, false, true);
00041 }
00042 else
00043 {
00044 ILOG_INFO("No keyframes available");
00045 }
00046
00047 ILOG_INFO("Reading thumbnails");
00048 #ifndef REPOSITORY_USED // Here comes the deprecated stuff
00049 ImageSet* imSetThumb =
00050 Core::ImageSet::MakeImageSet(options.GetString("imageSetThumbnails"),db);
00051 #else // REPOSITORY_USED
00052 ImageSet* imSetThumb =
00053 Core::ImageSet::MakeImageSet(options.GetString("imageSetThumbnails"));
00054 #endif // REPOSITORY_USED
00055 if (imSetThumb)
00056 {
00057 imSetThumb->SetImageSrc(! options.GetBool("noArchive"),
00058 options.GetBool("imFileArchive"),
00059 options.GetBool("imSplitArchive"));
00060 }
00061 else
00062 {
00063 ILOG_INFO("No thumbnails available");
00064 }
00065
00066 ILOG_INFO("Reading stills");
00067 #ifndef REPOSITORY_USED // Here comes the deprecated stuff
00068 ImageSet* imSetStill =
00069 Core::ImageSet::MakeImageSet(options.GetString("imageSetStills"), db);
00070 #else // REPOSITORY_USED
00071 ImageSet* imSetStill =
00072 Core::ImageSet::MakeImageSet(options.GetString("imageSetStills"));
00073 #endif // REPOSITORY_USED
00074 if (imSetStill)
00075 {
00076 imSetStill->SetImageSrc(false, false, true);
00077 }
00078 else
00079 {
00080 ILOG_INFO("No stills available");
00081 }
00082
00083 #ifndef REPOSITORY_USED // Here comes the deprecated stuff
00084 ILOG_INFO("reading shots");
00085 Segmentation* shots = new Segmentation(vidSet, "segmentation");
00086
00087 ILOG_INFO("reading keyframe set");
00088 Keyframes* keyframes = new Keyframes(vidSet, "keyframes");
00089 #else // REPOSITORY_USED
00090 ILOG_INFO("reading shots");
00091 using namespace Impala::Persistency;
00092 SegmentationLocator segLoc(vidSet->GetLocator(), "segmentation");
00093 Segmentation* shots = SegmentationRepository().Get(segLoc, vidSet);
00094
00095 ILOG_INFO("reading keyframe set");
00096 KeyframesLocator keyLoc(vidSet->GetLocator(), "keyframes");
00097 Keyframes* keyframes = KeyframesRepository().Get(keyLoc, vidSet);
00098 #endif // REPOSITORY_USED
00099
00100 SegmentationDocument* segDoc = new SegmentationDocument
00101 (vidSet, shots, keyframes, imSetKeyfr, imSetThumb, imSetStill);
00102 return segDoc;
00103 }
00104
00105 }
00106 }
00107 }
00108
00109 #endif