Horus Doc || C++ Reference || Class Overview   Pixels   Images   Detector   Geometry   Registry || Doxygen's quick Index  

VideoSeg.h

00001 /*
00002  *  Video Segmentation
00003  *
00004  *  Copyright (c) 2000, TNO TPD, The Netherlands.
00005  *  All rights reserved. No part of this software may be handed to or used by persons 
00006  *  or organisation outside Kenniscentrum Watergraafsmeer (UvA-ISIS, TNO TPD) without 
00007  *  the written permission of TNO TPD.
00008  *
00009  *  Author(s):
00010  *      Jan Baan (baan@tpd.tno.nl)
00011  *
00012  */
00013 
00014 /*
00015  * JV (07Nov02) added printToScreen functionality to avoid long list of frame numbers as output
00016  * JV (07Nov02) added setVerbose fucntion
00017  */
00018 
00019 #ifndef VideoSeg_h
00020 #define VideoSeg_h
00021 
00022 #include "HxImageSeq.h"
00023 #include "BaseClass.h"
00024 #include "vector"
00025 #include "HxException.h"
00026 #include "CounterConstDestr.h"
00027 #include "VxSegmentList.h"
00028 
00029 #define DEFAULT_CTlengthSlidWind 3 //5
00030 //#define DEFAULT_CTproportion 3 //2.5    
00031 #define DEFAULT_CTproportion 1.73 // sqrt(3)    
00032 //#define DEFAULT_CTthreshold 0.1 // 0.2
00033 #define DEFAULT_CTthreshold 0.32 // sqrt(0.1)
00034 #define DEFAULT_FrameDiffOverlap 10
00035 
00036 #define DEFAULT_frameDiffNumDeltaF 6 // Delta F = [1 2 4 8 ...]
00037 
00038 //#define DEFAULT_TRthreshold 0.7 //0.8
00039 #define DEFAULT_TRthreshold 0.84 //sqrt(0.7)
00040 //#define DEFAULT_TRthreshold2 0.4
00041 #define DEFAULT_TRthreshold2 0.63 // sqrt(0.4)
00042 #define DEFAULT_TRmaxDivMax 2
00043 #define DEFAULT_TRdeltaF 4
00044 
00045 #define numberOfHistogramValues 64 //256
00046 
00047 
00048 //#define frameWidth FrameWidth
00049 //#define frameHeight FrameHeight
00050 #define doubl double
00051 //#define nrFrames NumOfFrames
00052 
00053 class VideoSeg : public BaseClass, public CounterConstDestr<VideoSeg>
00054 {
00055     public:
00056         //VideoSeg() {}
00057 
00058         VideoSeg(const char *filename);
00059 
00060         VideoSeg(const HxImageSeq _Seq);
00061 
00062         ~VideoSeg() { };
00063 
00064         VxSegmentList           ToVxSegmentList();
00065 
00067         void FindCut(const int CTlengthSlidWind     = DEFAULT_CTlengthSlidWind, 
00068             const double CTproportion               = DEFAULT_CTproportion, 
00069             const double CTthreshold                = DEFAULT_CTthreshold);
00070         int GetNumberOfCuts() const;
00071         int GetCuts(const int index) const;
00072 
00073         
00075         void FindTrans(const double TRthreshold     = DEFAULT_TRthreshold, 
00076             const double TRthreshold2               = DEFAULT_TRthreshold2, 
00077             const int TRdeltaF                      = DEFAULT_TRdeltaF, 
00078             const double TRmaxDivMax                = DEFAULT_TRmaxDivMax);
00079         int GetNumberOfTrans() const;
00080         int GetTrans(const int index) const;
00081         int GetTransLength(const int index) const;
00082 
00083 
00090         void SaveFrameDiff(const char *filename) const; 
00091         void LoadFrameDiff(const char *filename); 
00092         
00094         void CalcFrameDiffGray();
00095 
00096         /***
00097          Added by JV, 07Nov02        
00098         ***/
00099         void        setVerbose(int val)
00100                     {_modeVerbose=val;}
00101     private:
00102         void Init();
00103 
00104         HxImageSeq seq;
00105         
00106         int frameDiffNumDeltaF;
00107         std::vector<double> frameDiff;
00108 
00109         double GetFrameDiff(const int frame, const int deltaF=0) const;
00110         void CalcFrameDiff();
00111         bool isCalcFrameDiff;
00112 
00113         void SanityCheck() const;
00114 
00116         std::vector<int> CTindex;
00117         bool CTisProcessed;
00118         
00120         std::vector<int> TRindex;
00121         std::vector<int> TRlength;
00122         bool TRisProcessed;
00123 
00124         /***
00125          Added by JV, 07Nov02, for controlling screen output statements      
00126         ***/
00127         int         _modeVerbose; // 0==full verbose, 1==none, 2==summary
00128         void printToScreen(int frameNumber);
00129 };
00130 
00131 
00132 #endif

Generated on Tue Feb 3 14:18:44 2004 for C++Reference by doxygen1.2.12 written by Dimitri van Heesch, © 1997-2001