CudaSaliency.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 CUDASALIENCY_H_DEFINED
00039 #define CUDASALIENCY_H_DEFINED
00040
00041 #include "Component/ModelComponent.H"
00042 #include "Component/ModelParam.H"
00043 #include "CUDA/CudaColorOps.H"
00044 #include "CUDA/CudaImage.H"
00045 #include "CUDA/CudaImageSet.H"
00046 #include "CUDA/CudaMathOps.H"
00047 #include "Image/DrawOps.H"
00048 #include "CUDA/CudaFilterOps.H"
00049 #include "Image/Pixels.H"
00050 #include "Image/PyramidTypes.H"
00051
00052 #include "Util/Types.H"
00053
00054 #include <cstdlib>
00055 #include <unistd.h>
00056 #include <list>
00057
00058
00059 template <class T> class CudaReichardtPyrBuilder;
00060
00061
00062 class CudaSaliency : public ModelComponent
00063 {
00064 public:
00065
00066
00067
00068
00069
00070
00071 CudaSaliency(OptionManager& mgr,
00072 const std::string& descrName = "CudaSaliency",
00073 const std::string& tagName = "CudaSaliency");
00074
00075
00076 ~CudaSaliency();
00077
00078
00079
00080
00081
00082
00083
00084 virtual void paramChanged(ModelParamBase* const param,
00085 const bool valueChanged,
00086 ParamClient::ChangeStatus* status);
00087
00088
00089
00090 void doInput(const Image< PixRGB<byte> > img);
00091
00092 void doCudaInput(const CudaImage< PixRGB<float> > img);
00093
00094 void setDevice(MemoryPolicy mp_in, int dev_in);
00095
00096
00097 void clearMaps();
00098
00099
00100 bool outputReady();
00101
00102
00103 Image<float> getOutput();
00104
00105 CudaImage<float> getCudaOutput();
00106
00107 CudaImage<float> getIMap();
00108
00109 CudaImage<float> getCMap();
00110
00111 CudaImage<float> getOMap();
00112
00113 CudaImage<float> getFMap();
00114
00115 CudaImage<float> getMMap();
00116
00117 CudaImage<float> getInertiaMap();
00118
00119 CudaImage<float> getInhibitionMap();
00120
00121 std::vector<Point2D<int> > getSalMaxLoc();
00122
00123 std::vector<float> getSalMax();
00124
00125 double getPatchSize();
00126
00127
00128 void runSaliency();
00129
00130
00131 CudaImage<float> cudaPostChannel(CudaImage<float> curImage, PyramidType ptyp, float orientation, float weight, CudaImage<float>& outmap);
00132
00133
00134 CudaImage<float> processPyramid(CudaImageSet<float> pyr);
00135
00136
00137 void calcIntensity(const CudaImage<PixRGB<float> > & colImage, CudaImage<float>& outmap);
00138
00139
00140 void calcColor(const CudaImage<PixRGB<float> > & colImage, CudaImage<float>& outmap);
00141
00142
00143 void calcOrientation(const CudaImage<PixRGB<float> > & colImage, float orientation, CudaImage<float>& outmap);
00144
00145
00146 void calcFlicker(const CudaImage<PixRGB<float> >& colImage, CudaImage<float>& outmap);
00147
00148
00149 void calcMotion(const CudaImage<PixRGB<float> > & colImage, int motionIndex);
00150
00151
00152 void calcInhibition(const CudaImage<float> & salMap);
00153
00154
00155 void calcInertia(const CudaImage<float> & salMap);
00156
00157
00158
00159 protected:
00160
00161 void start1();
00162 void stop2();
00163
00164 private:
00165 OModelParam<int> itsCudaDevice;
00166 Point2D<int> itsInertiaLoc;
00167 double itsCurrentInertiaFactor;
00168 CudaImage<float> itsInertiaMap;
00169 CudaImage<float> itsInhibitionMap;
00170 OModelParam<int> itsNMostSalientLoc;
00171 OModelParam<double> itsInertiaHalfLife;
00172 OModelParam<double> itsInertiaStrength;
00173 OModelParam<double> itsInertiaRadius;
00174 OModelParam<double> itsInertiaShiftThresh;
00175 OModelParam<double> itsIorHalfLife;
00176 OModelParam<double> itsIorStrength;
00177 OModelParam<double> itsIorRadius;
00178 OModelParam<double> itsPatchSize;
00179 double itsDynamicFactor;
00180 std::vector<Point2D<int> > itsSalMaxLoc;
00181 std::vector<float> itsSalMax;
00182 CudaImage<float> prevLum;
00183 CudaImage<float> curLum;
00184 CudaImageSet<float> curLumPyr;
00185 CudaReichardtPyrBuilder<float> *reichardtPyr;
00186 CudaImage<float> rg;
00187 CudaImage<float> by;
00188 CudaImage<float> randBuf;
00189 CudaImage<PixRGB<float> > colima;
00190 bool gotLum;
00191 bool gotRGBY;
00192 bool gotSaliency;
00193 CudaImage<float> outmap;
00194 CudaImage<float> intensityMap,colorMap,orientationMap,flickerMap,motionMap;
00195 CudaImage<float> convmap;
00196 MemoryPolicy mp;
00197 int dev;
00198 int numMotionDirs,numOrientationDirs;
00199
00200 };
00201
00202 #endif
00203
00204
00205
00206
00207
00208