00001 #ifndef SAS_IRD_HPP
00002 #define SAS_IRD_HPP
00003
00004 #include <map>
00005 #include "kernel/keyValueFile.hpp"
00006 #include "image/Image.hpp"
00007 #include "sas/conspicuity.hpp"
00008 #include "sas/irdm.hpp"
00009
00010 #define VISU 0
00011
00012 namespace jafar {
00013 namespace sas {
00014
00018 typedef enum RElevel {
00019 SALIENCY=0,
00020 CMAP=1,
00021 FMAP=2
00022 };
00023
00024 class IRDParams : public jafar::kernel::KeyValueFileLoad {
00025 public:
00026 jafar::sas::CParams cparams;
00027 double wI;
00028 double wC;
00029 double wO;
00030 double cThd;
00031 double sThd;
00032 int loglevels;
00033 int logkernsize;
00034
00035 IRDParams(jafar::sas::CParams cparams_=jafar::sas::CParams(),double wI_=1.0,
00036 double wC_=1.0, double wO_=1.0, double cThd_=0.1, double sThd_=0.5,
00037 int loglevels_=10, int logkernsize_=5) :
00038 cparams(cparams_),wI(wI_), wC(wC_), wO(wO_), cThd(cThd_), sThd(sThd_), loglevels(loglevels_), logkernsize(logkernsize_) {};
00039
00040 inline void loadCParams(std::string const & filename) {
00041 cparams.load(filename);
00042 };
00043
00044 protected:
00048 void loadKeyValueFile(jafar::kernel::KeyValueFile const& keyValueFile);
00049 };
00050
00055 class IRD {
00056 public:
00057
00058
00060 IRD(IRDM * dm_, IRDParams const & params_=IRDParams());
00061
00063 static inline IRD * createIRD(IRDM * dm_, std::string const & filename) {
00064 IRDParams params;
00065 params.load(filename);
00066 params.loadCParams(filename);
00067 return new IRD(dm_,params);
00068 };
00069
00071 ~IRD();
00072
00075 void computeSaliency();
00076
00079 void extractRoisCC(bool maskOnly = false, RElevel rel=CMAP);
00080
00081 #if 0
00082
00085 void extractRoisSS(bool maskOnly = false, RElevel rel=CMAP);
00086 #endif
00087
00091 void process(RElevel rel=CMAP) {
00092 computeSaliency();
00093 extractRoisCC(false,rel);
00094 };
00095
00096 jafar::image::Image draw(jafar::image::Image & display);
00097
00098 protected:
00099
00100 IRDM * dm;
00101
00102 IRDParams params;
00103
00104 std::map<std::string, Conspicuity *> cmaps;
00105
00106 std::vector<jafar::image::Image> LOG;
00107
00111 void extractChannels(jafar::image::Image const & src);
00112
00113 void extractChannels_walther(jafar::image::Image const & src);
00114
00118 std::pair<std::string,std::string> selectMap(CvPoint pmax) const;
00119
00120 #if 0
00121
00124 void computeLOG();
00125 #endif
00126
00127 friend class Engine;
00128
00129 };
00130
00131 }
00132 }
00133
00134 #endif // SAS_FEATURESALIENCY_HPP