RegSaliency.H

00001 /*!@file Image/RegSaliency.H A class for quick-and-dirty CUDA saliency mapping */
00002 
00003 // //////////////////////////////////////////////////////////////////// //
00004 // The iLab Neuromorphic Vision C++ Toolkit - Copyright (C) 2000-2003   //
00005 // by the University of Southern California (USC) and the iLab at USC.  //
00006 // See http://iLab.usc.edu for information about this project.          //
00007 // //////////////////////////////////////////////////////////////////// //
00008 // Major portions of the iLab Neuromorphic Vision Toolkit are protected //
00009 // under the U.S. patent ``Computation of Intrinsic Perceptual Saliency //
00010 // in Visual Environments, and Applications'' by Christof Koch and      //
00011 // Laurent Itti, California Institute of Technology, 2001 (patent       //
00012 // pending; application number 09/912,225 filed July 23, 2001; see      //
00013 // http://pair.uspto.gov/cgi-bin/final/home.pl for current status).     //
00014 // //////////////////////////////////////////////////////////////////// //
00015 // This file is part of the iLab Neuromorphic Vision C++ Toolkit.       //
00016 //                                                                      //
00017 // The iLab Neuromorphic Vision C++ Toolkit is free software; you can   //
00018 // redistribute it and/or modify it under the terms of the GNU General  //
00019 // Public License as published by the Free Software Foundation; either  //
00020 // version 2 of the License, or (at your option) any later version.     //
00021 //                                                                      //
00022 // The iLab Neuromorphic Vision C++ Toolkit is distributed in the hope  //
00023 // that it will be useful, but WITHOUT ANY WARRANTY; without even the   //
00024 // implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      //
00025 // PURPOSE.  See the GNU General Public License for more details.       //
00026 //                                                                      //
00027 // You should have received a copy of the GNU General Public License    //
00028 // along with the iLab Neuromorphic Vision C++ Toolkit; if not, write   //
00029 // to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,   //
00030 // Boston, MA 02111-1307 USA.                                           //
00031 // //////////////////////////////////////////////////////////////////// //
00032 //
00033 // Primary maintainer for this file: Zack Gossman <gossman@usc.edu>
00034 // $HeadURL: svn://isvn.usc.edu/software/invt/trunk/saliency/src/CUDA/RegSaliency.H $
00035 // $Id: RegSaliency.H 12962 2010-03-06 02:13:53Z irock $
00036 //
00037 
00038 #ifndef REGSALIENCY_H_DEFINED
00039 #define REGSALIENCY_H_DEFINED
00040 
00041 #include "Component/ModelComponent.H"
00042 #include "Component/ModelParam.H"
00043 #include "Image/ColorOps.H"
00044 #include "Image/Image.H"
00045 #include "Image/ImageSet.H"
00046 #include "Image/MathOps.H"
00047 #include "Image/DrawOps.H"
00048 #include "Image/FilterOps.H"
00049 #include "Image/PyrBuilder.H"
00050 #include "Image/Pixels.H"
00051 #include "Image/PyramidTypes.H"
00052 #include "Image/PyramidOps.H"
00053 #include "Image/ShapeOps.H"
00054 #include "Image/Transforms.H"
00055 #include "Image/fancynorm.H"
00056 
00057 #include "Util/Types.H"
00058 
00059 #include <cstdlib>
00060 #include <unistd.h>
00061 #include <list>
00062 
00063 
00064 // ######################################################################
00065 class RegSaliency : public ModelComponent
00066 {
00067 public:
00068 
00069   // ######################################################################
00070   /*! @name Constructors and Destructors */
00071   //@{
00072 
00073   //! Constructor
00074   RegSaliency(OptionManager& mgr,
00075              const std::string& descrName = "Regsaliency",
00076              const std::string& tagName = "Regsaliency");
00077 
00078   //! Destructor
00079   ~RegSaliency();
00080 
00081   //@}
00082 
00083   // ######################################################################
00084   /*! @name member functions */
00085   //@{
00086 
00087   //! Setup up with image to be processed and build the job queue
00088   void doInput(const Image< PixRGB<byte> > img);
00089 
00090   //! Is the last given input done processing?
00091   bool outputReady();
00092 
00093   //! Get last computed output
00094   Image<float> getOutput();
00095 
00096   Image<float> getIMap();
00097 
00098   Image<float> getCMap();
00099 
00100   Image<float> getOMap();
00101 
00102   Image<float> getFMap();
00103 
00104   Image<float> getMMap();
00105 
00106   Image<float> getInertiaMap();
00107 
00108   Image<float> getInhibitionMap();
00109 
00110 
00111   //! For internal thread use: Compute a conspicuity map from an image
00112   void runSaliency();
00113 
00114   //! Calculate the pyramid and post the generated conspicuity map to the saliency output map
00115   Image<float> postChannel(Image<float> curImage, PyramidType ptyp, float orientation, float weight, Image<float>& outmap);
00116 
00117   // Just process the pyramid to get the conspicuity map using center surround max norm process
00118   Image<float> processPyramid(ImageSet<float> pyr);
00119 
00120   //! Calculate intensity channel
00121   void calcIntensity(const Image<PixRGB<float> > & colImage, Image<float>& outmap);
00122 
00123   //! Calculate the color oppponent channel
00124   void calcColor(const Image<PixRGB<float> > & colImage, Image<float>& outmap);
00125 
00126   //! Calculate a particular orientation channel
00127   void calcOrientation(const Image<PixRGB<float> > & colImage, float orientation, Image<float>& outmap);
00128 
00129   //! Calculate the flicker channel
00130   void calcFlicker(const Image<PixRGB<float> >& colImage, Image<float>& outmap);
00131 
00132   //! Calculate the motion channel
00133   void calcMotion(const Image<PixRGB<float> > & colImage, int motionIndex);
00134   //@}
00135 
00136 protected:
00137 
00138   void start1(); //!< get started
00139   void stop2();  //!< get stopped
00140 
00141 private:
00142   Image<float> prevLum;
00143   Image<float> curLum;
00144   ImageSet<float> curLumPyr;
00145   ReichardtPyrBuilder<float> **reichardtPyr;
00146   Image<float> rg;
00147   Image<float> by;
00148   Image<float> randBuf;
00149   Image<PixRGB<float> > colima;
00150   bool gotLum;
00151   bool gotRGBY;
00152   bool gotSaliency;
00153   Image<float> outmap;
00154   Image<float> itsInertiaMap;
00155   Image<float> itsInhibitionMap;
00156   Image<float> intensityMap,colorMap,orientationMap,flickerMap,motionMap;
00157   Image<float> convmap;
00158   int numMotionDirs,numOrientationDirs;
00159 
00160 };
00161 
00162 #endif
00163 
00164 // ######################################################################
00165 /* So things look consistent in everyone's emacs... */
00166 /* Local Variables: */
00167 /* indent-tabs-mode: nil */
00168 /* End: */
Generated on Sun May 8 08:40:36 2011 for iLab Neuromorphic Vision Toolkit by  doxygen 1.6.3