00001
00002 #ifndef _SAS_ENGINE_HPP_
00003 #define _SAS_ENGINE_HPP_
00004
00005 #include "datareader/DataReader.hpp"
00006 #include "image/Image.hpp"
00007 #include "sas/irdm.hpp"
00008 #include "sas/ird.hpp"
00009 #include "sas/irt.hpp"
00010
00011 namespace jafar {
00012 namespace sas {
00013
00017 class Engine {
00018 public:
00019
00020 Engine (IRDM * dm=0) {
00021 if (dm)
00022 m_dm = dm;
00023 else
00024 m_dm = new IRDM();
00025 m_d = new IRD(m_dm);
00026 m_t = new BK_IRT(m_dm);
00027 };
00028
00029 Engine (std::string const & filename) {
00030 m_dm = new IRDM();
00031 m_d = IRD::createIRD(m_dm,filename);
00032 m_t = BK_IRT::createBKIRT(m_dm,filename);
00033 };
00034
00035 virtual ~Engine () {
00036 delete m_d;
00037 delete m_t;
00038 if (m_dm)
00039 delete m_dm;
00040 };
00041
00042 inline void attachSrc(jafar::image::Image const & src) {
00043 m_dm->attachImg("src",src);
00044 };
00045
00046 inline void setSrc(jafar::image::Image const & src) {
00047 m_dm->setImg("src",src);
00048 }
00049
00050 inline IRDM * detachDM() {
00051 IRDM * dm = m_dm;
00052 m_dm = 0;
00053 return dm;
00054 }
00055
00056 inline IRDM * getDM() const {
00057 return m_dm;
00058 };
00059
00060 inline jafar::image::Image const & getImgFromDM(std::string const & label) const {
00061 return m_dm->m_imgs.find(label)->second;
00062 };
00063
00064 inline jafar::image::Image const & getMapFromDetector(std::string const & label, int c=-1, int s=-1) const {
00065 if ( c==-1 && s==-1)
00066 return m_d->cmaps[label]->getMap("cmap");
00067 else if (c!=-1 && s!=-1)
00068 return m_d->cmaps[label]->getMap(jafar::sas::Conspicuity::getLabel(c,s));
00069 else
00070 JFR_RUN_TIME("wrong feature map index");
00071 };
00072
00073 void initCamModel(jafar::datareader::DataReader * dr);
00074
00081 void processPano(jafar::datareader::DataReader * dr, int begin=-1, int last=-1);
00082
00089 void processMono(jafar::datareader::DataReader * dr, std::string const & benchname, int begin, int last);
00090
00094 void oneStepTracking(int rel=0);
00095
00099 void computeSirs(int rel=0);
00100
00101
00105 inline void drawTracking(jafar::image::Image & display) const {
00106 m_t->draw(display);
00107 };
00108
00112 inline void drawSirs(jafar::image::Image & display) const {
00113 m_d->draw(display);
00114 };
00115
00116 private:
00117 IRDM * m_dm;
00118 IRD * m_d;
00119 BK_IRT * m_t;
00120
00121
00122 };
00123
00124 namespace tools {
00128 void convert(jafar::image::Image const & src, jafar::image::Image & dst, jafar::image::Image const & lut=0);
00129
00133 jafar::image::Image createRedHotLut();
00134
00138 jafar::image::Image displayFromLut(jafar::image::Image const & lut);
00139
00140 };
00141
00142 }
00143 }
00144
00145
00146 #endif