PatchExtractor.hpp

00001 /**************************************************
00002 
00003   PatchExtractor class
00004 
00005   Antoni Chan,
00006   City University of Hong Kong, Copyright 2014
00007   libdt - OpenCV library for Dynamic Textures - version 1.0
00008 
00009 ***************************************************/
00010 
00011 #ifndef PATCHEXTRACTOR_HPP
00012 #define PATCHEXTRACTOR_HPP
00013 
00014 using namespace cv;
00015 using namespace std;
00016 
00034 class PatchExtractor
00035 {
00036 
00037 public:
00041   enum fill_type { FILL_NN,  
00042                    FILL_NNFILL,          
00043                    FILL_VOTE,            
00044   };
00045 
00046   PatchOptions     patopt;   
00047   int              vrows,    
00048                    vcols;    
00049   vector<Point2i>  locyx;    
00050   vector<bool>     locyx_mask;    
00051   int              locz;     
00052   int              curz;     
00053   int              nextz;    
00054   Point3i          coff;     
00055   vector<int>      allx;     
00056   vector<int>      ally;     
00058 public:
00059   Mat         vbuf;     
00060   Mat         vbuf_zm;  
00061   vector<Mat> patches;  
00062   bool        flag_zm;  
00063   Mat         frame_center;   
00064   Mat         frame_patches;  
00066 public:  
00072   PatchExtractor(const PatchOptions &patopt, int vrows, int vcols);
00073   PatchExtractor(){}
00074   ~PatchExtractor();
00075 
00076   // basic operations
00079   void reset();                  
00080   
00082   int  framesToNextPatch();
00083   
00088   bool addFrames(const Mat &vid);   
00089   
00092   const vector<Mat> & getPatches();
00093   
00096   const Mat & getCenterFrame();
00097   
00102   const Mat & getPatchFrames();
00103   
00105   const Mat & getbuf(); 
00106   
00110   const Mat & getbuf_zm(); 
00111 
00112   // conversion utilities
00120   void patchLabelsToImage(const Mat &patLabels, Mat &imgLabels, 
00121                           fill_type fillMode=FILL_NN);
00122 
00123   // debugging
00125   void dump(ostream &output) const;
00127   void dump_matlab_init(ostream &output) const;
00129   void dump_matlab_patches(ostream &output) const;
00133   friend ostream& operator <<(ostream &output, const PatchExtractor &cov);
00134 
00135   
00136 
00137 private: 
00138 
00141   void getLoc();
00145   void processNextPatch();
00146 };
00147 
00148 #endif

Generated on 18 Dec 2014 for libdt-OpenCV by  doxygen 1.6.1