00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #ifndef VideoSeg_h
00017 #define VideoSeg_h
00018
00019 #include "HxImageSeq.h"
00020 #include "BaseClass.h"
00021 #include "vector"
00022 #include "HxException.h"
00023 #include "CounterConstDestr.h"
00024 #include "VxSegmentList.h"
00025
00026 #define DEFAULT_CTlengthSlidWind 3 //5
00027
00028 #define DEFAULT_CTproportion 1.73 // sqrt(3)
00029
00030 #define DEFAULT_CTthreshold 0.32 // sqrt(0.1)
00031 #define DEFAULT_FrameDiffOverlap 10
00032
00033 #define DEFAULT_frameDiffNumDeltaF 6 // Delta F = [1 2 4 8 ...]
00034
00035
00036 #define DEFAULT_TRthreshold 0.84 //sqrt(0.7)
00037
00038 #define DEFAULT_TRthreshold2 0.63 // sqrt(0.4)
00039 #define DEFAULT_TRmaxDivMax 2
00040 #define DEFAULT_TRdeltaF 4
00041
00042 #define numberOfHistogramValues 64 //256
00043
00044
00045
00046
00047 #define doubl double
00048
00049
00050 class VideoSeg : public BaseClass, public CounterConstDestr<VideoSeg>
00051 {
00052 public:
00053
00054
00055 VideoSeg(const char *filename);
00056
00057 VideoSeg(const HxImageSeq _Seq);
00058
00059 ~VideoSeg() { };
00060
00061 VxSegmentList ToVxSegmentList();
00062
00064 void FindCut(const int CTlengthSlidWind = DEFAULT_CTlengthSlidWind,
00065 const double CTproportion = DEFAULT_CTproportion,
00066 const double CTthreshold = DEFAULT_CTthreshold);
00067 int GetNumberOfCuts() const;
00068 int GetCuts(const int index) const;
00069
00070
00072 void FindTrans(const double TRthreshold = DEFAULT_TRthreshold,
00073 const double TRthreshold2 = DEFAULT_TRthreshold2,
00074 const int TRdeltaF = DEFAULT_TRdeltaF,
00075 const double TRmaxDivMax = DEFAULT_TRmaxDivMax);
00076 int GetNumberOfTrans() const;
00077 int GetTrans(const int index) const;
00078 int GetTransLength(const int index) const;
00079
00080
00087 void SaveFrameDiff(const char *filename) const;
00088 void LoadFrameDiff(const char *filename);
00089
00091 void CalcFrameDiffGray();
00092
00093 private:
00094 void Init();
00095
00096 HxImageSeq seq;
00097
00098 int frameDiffNumDeltaF;
00099 std::vector<double> frameDiff;
00100
00101 double GetFrameDiff(const int frame, const int deltaF=0) const;
00102 void CalcFrameDiff();
00103 bool isCalcFrameDiff;
00104
00105 void SanityCheck() const;
00106
00108 std::vector<int> CTindex;
00109 bool CTisProcessed;
00110
00112 std::vector<int> TRindex;
00113 std::vector<int> TRlength;
00114 bool TRisProcessed;
00115
00116
00117 };
00118
00119
00120 #endif