BeoSubSaliency.H
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038 #ifndef BEOSUBSALIENCY_H_DEFINED
00039 #define BEOSUBSALIENCY_H_DEFINED
00040
00041 #include "Component/ModelManager.H"
00042 #include "Image/ColorOps.H"
00043 #include "Image/Image.H"
00044 #include "Image/ImageSet.H"
00045 #include "Image/MathOps.H"
00046 #include "Image/DrawOps.H"
00047 #include "Image/FilterOps.H"
00048 #include "Image/Pixels.H"
00049 #include "Image/PyramidOps.H"
00050 #include "Image/ShapeOps.H"
00051 #include "Image/Transforms.H"
00052 #include "Image/fancynorm.H"
00053 #include "Util/Types.H"
00054 #include "GUI/XWindow.H"
00055 #include "Image/colorDefs.H"
00056
00057 #include <pthread.h>
00058 #include <cstdlib>
00059 #include <unistd.h>
00060 #include <list>
00061
00062
00063
00064
00065
00066 #define sml 2
00067 #define delta_min 3
00068 #define delta_max 4
00069 #define level_min 0
00070 #define level_max 2
00071 #define maxdepth (level_max + delta_max + 1)
00072 #define normtyp (VCXNORM_MAXNORM)
00073
00074
00075 #define IWEIGHT 0.7
00076 #define CWEIGHT 1.0
00077 #define OWEIGHT 1.0
00078 #define FWEIGHT 4.0
00079 #define SWEIGHT 2.0
00080
00081
00082 #define IMAGEWIDTH 160
00083 #define IMAGEHEIGHT 120
00084
00085
00086 #define RETINA 1
00087 #define WINNER 2
00088 #define LUMINANCE 3
00089 #define REDGREEN 4
00090 #define BLUEYELLOW 5
00091 #define ORI0 6
00092 #define ORI45 7
00093 #define ORI90 8
00094 #define ORI135 9
00095 #define CMAP 10
00096 #define FLICKER 11
00097 #define INTENSITY 12
00098 #define SKINHUE 13
00099
00100 struct jobData{
00101 jobData() { };
00102
00103 jobData(const int jt, const PyramidType pt, const float w,
00104 const float ori = 0.0F) :
00105 jobType(jt), ptyp(pt), weight(w), orientation(ori) { }
00106
00107 int jobType;
00108 PyramidType ptyp;
00109 float weight;
00110 float orientation;
00111 };
00112
00113 class BeoSubSaliency : public ModelComponent
00114 {
00115 public:
00116
00117
00118
00119
00120
00121
00122 BeoSubSaliency(OptionManager& mgr,
00123 const std::string& descrName = "SaliencyMT",
00124 const std::string& tagName = "SaliencyMT");
00125
00126
00127 ~BeoSubSaliency();
00128
00129
00130
00131
00132
00133
00134
00135
00136 Point2D<int> run(Image< PixRGB<byte> > img, bool debug = false);
00137
00138
00139 void computeCMAP();
00140
00141
00142 protected:
00143 OModelParam<uint> itsNumThreads;
00144
00145 private:
00146 Image< PixRGB<byte> > colima;
00147 Image<float> lum;
00148 Image<byte> r, g, b, y;
00149 Image<float> previma;
00150 Image<float> outmap;
00151 Image<float> skinima;
00152
00153
00154
00155 Point2D<int> win, winsm;
00156 float maxval;
00157
00158 PyramidType ptyp;
00159
00160
00161 rutz::shared_ptr<XWindow> wini, wino;
00162 bool debugmode;
00163 bool hasRun;
00164
00165
00166 std::list<jobData> jobQueue;
00167 bool jobsReady;
00168 bool dataReady;
00169 int jobsDone;
00170 int totalJobs;
00171 bool gotRGBY; bool gotLum;
00172
00173
00174 pthread_t *worker;
00175 pthread_mutex_t jobLock, condLock, mapLock;
00176 pthread_cond_t jobCond;
00177 };
00178
00179 #endif
00180
00181
00182
00183
00184
00185