CaptureEngine.h
Go to the documentation of this file.
00001 /*
00002  * CaptureEngine.h
00003  *
00004  *  Created on: Oct 22, 2010
00005  *      Author: erublee
00006  */
00007 
00008 #ifndef CAPTUREENGINE_H_
00009 #define CAPTUREENGINE_H_
00010 
00011 #include "pano_core/BlurDetector.h"
00012 #include "pano_core/Camera.h"
00013 #include "pano_core/MoleculeProcessor.h"
00014 
00015 #include "opencv2/features2d/features2d.hpp"
00016 #include "pano_core/callbacks.h"
00017 
00018 namespace pano
00019 {
00020 
00021 class PriorTracker
00022 {
00023 public:
00024   PriorTracker(int max_fail_count = 3);
00025   Extrinsics track(ImageAtom& query, ModelFitter& fitter, FitterResult* result = NULL);
00026   void updatePrior(const ImageAtom& prior);
00027 
00035   template<typename Function>
00036   void addMatchesCallback(const Function& f){
00037     callbacks_.addCallback<AtomPair>(MATCHES_CALLBACK,f);
00038   }
00039 
00043   template<typename Function>
00044   void addPriorUpdateCallback(const Function& f){
00045     callbacks_.addCallback<cv::Ptr<ImageAtom> >(PRIOR_UPDATE_CB,f);
00046   }
00047 
00048 private:
00049   enum {
00050     MATCHES_CALLBACK = 0,
00051         PRIOR_UPDATE_CB
00052   };
00053   ImageAtom prior_;
00054   int max_fail_count_;
00055   int fail_count_;
00056   CallbackEngine callbacks_;
00057 
00058 };
00059 
00060 class CaptureEngine
00061 {
00062 public:
00063   CaptureEngine():fail_count_(1){}
00064   CaptureEngine(cv::Ptr<ModelFitter> fitter, cv::Ptr<cv::FeatureDetector> detector, Camera camera,
00065                 const std::string& dirname);
00066   virtual ~CaptureEngine();
00067 
00068   virtual cv::Ptr<ImageAtom> onNewFrame(const cv::Mat& img);
00069 
00070   MoleculeGlob& glob()
00071   {
00072     return glob_;
00073   }
00074   const MoleculeGlob& glob() const
00075   {
00076     return glob_;
00077   }
00078   const ImageAtom& latestAtom() const{
00079     return atom_;
00080   }
00081 
00082   void reset();
00083 
00084   enum {FAIL_MAX = 4};
00085 
00086 protected:
00087   cv::Ptr<ModelFitter> fitter_;
00088   cv::Ptr<cv::FeatureDetector> detector_;
00089   Camera camera_;
00090   ImageAtom atom_;
00091   MoleculeGlob glob_;
00092   PriorTracker prior_tracker_;
00093   int fail_count_;
00094   std::string dirname_;
00095   BlurDetector blur_detector_;
00096 };
00097 }
00098 #endif /* CAPTUREENGINE_H_ */


pano_core
Author(s): Ethan Rublee
autogenerated on Mon Oct 6 2014 08:04:38