00001
00002 #ifndef _SAS_IRDM_HPP_
00003 #define _SAS_IRDM_HPP_
00004
00005 #include <map>
00006 #include <list>
00007 #include <string>
00008 #include "camera/cameraBarreto.hpp"
00009 #include "image/Image.hpp"
00010 namespace jafar {
00011 namespace sas {
00012
00016 struct sir {
00017 CvHistogram * hist;
00018 float x,y,w,h,area;
00019 std::string c,f;
00020
00021 sir() : hist(0) {};
00022 ~sir() {
00023 if (hist) cvReleaseHist(&hist);
00024 }
00025 };
00026
00027
00031 struct sTrack {
00032 int m_ID;
00033 bool m_tracked;
00034 int m_nFrames;
00035 int m_firstFrame;
00036 std::list<sir *> m_track;
00037
00038 ~sTrack();
00039 };
00040
00044 class IRDM {
00045 public:
00046 IRDM () : m_next_ID(0), m_cur_Frame(0), m_camModelInit(false) {};
00047 virtual ~IRDM ();
00048
00049 inline sTrack * createSTrack(sir * s) {
00050 sTrack * stk = new sTrack();
00051 stk->m_ID = m_next_ID++;
00052 stk->m_firstFrame = m_cur_Frame;
00053 stk->m_nFrames = 1;
00054 stk->m_tracked = true;
00055 stk->m_track.push_back(s);
00056 m_stracks.push_back(stk);
00057 return stk;
00058 };
00059
00060
00061
00062 inline void attachImg(std::string const & label, jafar::image::Image const & img) {
00063 m_imgs[label] = img;
00064 };
00065 inline void setImg(std::string const & label, jafar::image::Image const & img) {
00066 m_imgs[label] = img.clone();
00067 };
00068
00069 inline jafar::image::Image & getImg(std::string const & label) {
00070 return m_imgs[label];
00071 };
00072
00073 inline bool isCamModelInit() const {
00074 return m_camModelInit;
00075 };
00076
00077 inline jafar::camera::CameraParabolicBarreto const & getCamModel() const {
00078 return m_camModel;
00079 };
00080
00081 inline std::list<sTrack *> const & getSTrackList () const {return m_stracks;};
00082
00083 private:
00084 int m_next_ID;
00085 int m_cur_Frame;
00086 bool m_camModelInit;
00087 std::list<sir *> m_sirs;
00088 std::list<sTrack *> m_stracks;
00089 std::map<std::string, jafar::image::Image> m_imgs;
00090 jafar::camera::CameraParabolicBarreto m_camModel;
00091
00092
00093
00094 friend class IRD;
00095 friend class CV_IRT_BlobDetector;
00096 friend class CV_IRT;
00097 friend class BK_IRT;
00098 friend class Engine;
00099 };
00100
00101 }
00102 }
00103
00104
00105 #endif