PopulationHeadingMap.H

Go to the documentation of this file.
00001 /*!@file Robots/Beobot2/Navigation/FOE_Navigation/PopulationHeadingMap.H
00002   Lappe&Rauschecker 1993's Population Heading Map algorithm
00003  */
00004 // //////////////////////////////////////////////////////////////////// //
00005 // The iLab Neuromorphic Vision C++ Toolkit - Copyright (C) 2001 by the //
00006 // University of Southern California (USC) and the iLab at USC.         //
00007 // See http://iLab.usc.edu for information about this project.          //
00008 // //////////////////////////////////////////////////////////////////// //
00009 // Major portions of the iLab Neuromorphic Vision Toolkit are protected //
00010 // under the U.S. patent ``Computation of Intrinsic Perceptual Saliency //
00011 // in Visual Environments, and Applications'' by Christof Koch and      //
00012 // Laurent Itti, California Institute of Technology, 2001 (patent       //
00013 // pending; application number 09/912,225 filed July 23, 2001; see      //
00014 // http://pair.uspto.gov/cgi-bin/final/home.pl for current status).     //
00015 // //////////////////////////////////////////////////////////////////// //
00016 // This file is part of the iLab Neuromorphic Vision C++ Toolkit.       //
00017 //                                                                      //
00018 // The iLab Neuromorphic Vision C++ Toolkit is free software; you can   //
00019 // redistribute it and/or modify it under the terms of the GNU General  //
00020 // Public License as published by the Free Software Foundation; either  //
00021 // version 2 of the License, or (at your option) any later version.     //
00022 //                                                                      //
00023 // The iLab Neuromorphic Vision C++ Toolkit is distributed in the hope  //
00024 // that it will be useful, but WITHOUT ANY WARRANTY; without even the   //
00025 // implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      //
00026 // PURPOSE.  See the GNU General Public License for more details.       //
00027 //                                                                      //
00028 // You should have received a copy of the GNU General Public License    //
00029 // along with the iLab Neuromorphic Vision C++ Toolkit; if not, write   //
00030 // to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,   //
00031 // Boston, MA 02111-1307 USA.                                           //
00032 // //////////////////////////////////////////////////////////////////// //
00033 //
00034 // Primary maintainer for this file: Christian Siagian <siagian@usc.edu>
00035 // $HeadURL: svn://isvn.usc.edu/software/invt/trunk/saliency/src/Robots/Beobot2/Navigation/FOE_Navigation/PopulationHeadingMap.C $
00036 // $Id: $
00037 //
00038 
00039 #ifndef ROBOTS_BEOBOT2_NAVIGATION_FOENAVIGATION_POPULATIONHEADINGMAP_DEFINED
00040 #define ROBOTS_BEOBOT2_NAVIGATION_FOENAVIGATION_POPULATIONHEADINGMAP_DEFINED
00041 
00042 #include "Image/Image.H"
00043 #include "Image/Pixels.H"
00044 #include "Raster/Raster.H"
00045 
00046 #include "GUI/XWinManaged.H"
00047 
00048 #include "Robots/Beobot2/Navigation/FOE_Navigation/MotionOps.H"
00049 
00050 //! Lappe&Rauschecker's Population Heading Map algorithm
00051 class PopulationHeadingMap
00052 {
00053 public:
00054   // ######################################################################
00055   //! @name Constructor, assigment and destructor
00056   //@{
00057 
00058   //! Constructor 
00059   PopulationHeadingMap(float focalLength);
00060 
00061   //! blank constructor with an optional name entry
00062   PopulationHeadingMap(const std::string& name = "");
00063 
00064   //! function to populate the weights
00065   void initialize(Dims dims);
00066 
00067   //! function to load the weights from a file
00068   //bool loadFrom(const std::string& fname);
00069 
00070   //! function to save weights
00071   //bool saveTo(const std::string& fname);
00072 
00073   //! Destructor
00074   ~PopulationHeadingMap();
00075 
00076   //@}
00077 
00078   // ######################################################################
00079   //! @name Access functions
00080   //@{
00081 
00082   void setFocalLength(float focalLength);
00083   
00084   //@}
00085 
00086   // ######################################################################
00087   //! @name Compute functions
00088   //@{
00089 
00090   //! return FOE from image of movement between the two input images
00091   void getFOE(Image<byte> stim1, Image<byte> stim2);
00092 
00093   //! return 
00094   void getFOE(Image<byte> stim);
00095 
00096   //@}
00097 
00098 private:
00099 
00100   //! the current image
00101   Image<byte> itsCurrentImage;
00102   
00103   //! the previous image
00104   Image<byte> itsPreviousImage;
00105 
00106   //! its input OpticFlow
00107   rutz::shared_ptr<OpticalFlow> itsOpticalFlow;
00108 
00109   //! display optical flow image
00110   Image<PixRGB<byte> > itsOpticalFlowImage;
00111 
00112   //! MT features: encode direction firing rate
00113   std::vector<Image<float> > itsMTfeatures;
00114 
00115   //! MT features: encode direction firing rate
00116   //! NOTE: NOT USED CURRENTLY
00117   std::vector <Image<float> > itsMToptimalShift;
00118 
00119   //! name of the landmark
00120   std::vector<Image<float> > itsJ;
00121 
00122   //! focal length
00123   float itsFocalLength;
00124 
00125   //! debug window
00126   rutz::shared_ptr<XWinManaged> itsWin;
00127 
00128   //! the heading direction map
00129   //! the maximum is the most likely heading direction
00130   Image<float> itsHeadingDirectionMap; 
00131 
00132   // ######################################################################
00133   //! @name Compute functions (all the inner-working functions)
00134   //@{
00135 
00136   //! compute the population heading map
00137   void computePopulationHeading();
00138 
00139   //! select n random locations from the optic flow
00140   std::vector<uint> pickRandomLocations(uint m);
00141   std::vector<Point2D<float> > getLocations(std::vector<uint> lind);
00142   std::vector<Point2D<float> > getFlowVectors(std::vector<uint> lind);
00143   
00144   //! compute C(T) 
00145   Image<double> computeC
00146   (std::vector<Point2D<float> > points, uint jx, uint jy);
00147 
00148   //! compute the orthogonal complement matrix C_perp(T)
00149   Image<double> computeOrthogonalComplement(Image<double> C);
00150 
00151   //! simple sigmoid function
00152   double sigmoid(double x); 
00153 
00154   void print(Image<double> img, const std::string& name);
00155 
00156   //@}
00157 };
00158 
00159 // ######################################################################
00160 // Implementation for PopulationHeadingMap inline functions
00161 // ######################################################################
00162 
00163 
00164 #endif // ROBOTS_BEOBOT2_NAVIGATION_FOENAVIGATION_POPULATIONHEADINGMAP_DEFINED
00165 
00166 // ######################################################################
00167 /* So things look consistent in everyone's emacs... */
00168 /* Local Variables: */
00169 /* indent-tabs-mode: nil */
00170 /* End: */
Generated on Sun May 8 08:05:36 2011 for iLab Neuromorphic Vision Toolkit by  doxygen 1.6.3