00001 /** 00002 \file Robots/LoBot/lgmd/gabbiani/LoGabbiani.H 00003 \brief Gabbiani's LGMD model. 00004 */ 00005 00006 // //////////////////////////////////////////////////////////////////// // 00007 // The iLab Neuromorphic Vision C++ Toolkit - Copyright (C) 2000-2005 // 00008 // by the University of Southern California (USC) and the iLab at USC. // 00009 // See http://iLab.usc.edu for information about this project. // 00010 // //////////////////////////////////////////////////////////////////// // 00011 // Major portions of the iLab Neuromorphic Vision Toolkit are protected // 00012 // under the U.S. patent ``Computation of Intrinsic Perceptual Saliency // 00013 // in Visual Environments, and Applications'' by Christof Koch and // 00014 // Laurent Itti, California Institute of Technology, 2001 (patent // 00015 // pending; application number 09/912,225 filed July 23, 2001; see // 00016 // http://pair.uspto.gov/cgi-bin/final/home.pl for current status). // 00017 // //////////////////////////////////////////////////////////////////// // 00018 // This file is part of the iLab Neuromorphic Vision C++ Toolkit. // 00019 // // 00020 // The iLab Neuromorphic Vision C++ Toolkit is free software; you can // 00021 // redistribute it and/or modify it under the terms of the GNU General // 00022 // Public License as published by the Free Software Foundation; either // 00023 // version 2 of the License, or (at your option) any later version. // 00024 // // 00025 // The iLab Neuromorphic Vision C++ Toolkit is distributed in the hope // 00026 // that it will be useful, but WITHOUT ANY WARRANTY; without even the // 00027 // implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR // 00028 // PURPOSE. See the GNU General Public License for more details. // 00029 // // 00030 // You should have received a copy of the GNU General Public License // 00031 // along with the iLab Neuromorphic Vision C++ Toolkit; if not, write // 00032 // to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, // 00033 // Boston, MA 02111-1307 USA. // 00034 // //////////////////////////////////////////////////////////////////// // 00035 // 00036 // Primary maintainer for this file: mviswana usc edu 00037 // $HeadURL: svn://isvn.usc.edu/software/invt/trunk/saliency/src/Robots/LoBot/lgmd/gabbiani/LoGabbiani.H $ 00038 // $Id: LoGabbiani.H 13628 2010-06-28 23:48:02Z mviswana $ 00039 // 00040 00041 #ifndef LOBOT_GABBIANI_LGMD_MODEL_DOT_H 00042 #define LOBOT_GABBIANI_LGMD_MODEL_DOT_H 00043 00044 //------------------------------ HEADERS -------------------------------- 00045 00046 // lobot headers 00047 #include "Robots/LoBot/lgmd/LocustModel.H" 00048 #include "Robots/LoBot/io/LoInputSource.H" 00049 #include "Robots/LoBot/misc/factory.hh" 00050 #include "Robots/LoBot/misc/singleton.hh" 00051 00052 // INVT headers 00053 #include "Image/Rectangle.H" 00054 00055 // Standard C++ headers 00056 #include <string> 00057 00058 //----------------------------- NAMESPACE ------------------------------- 00059 00060 namespace lobot { 00061 00062 //------------------------- CLASS DEFINITION ---------------------------- 00063 00064 /** 00065 \class lobot::GabbianiModel 00066 \brief Implementation of Gabbiani's LGMD model. 00067 */ 00068 class GabbianiModel : public LocustModel { 00069 // Prevent copy and assignment 00070 GabbianiModel(const GabbianiModel&) ; 00071 GabbianiModel& operator=(const GabbianiModel&) ; 00072 00073 // Handy type to have around 00074 typedef LocustModel base ; 00075 00076 // Boilerplate code to make the factory work 00077 friend class subfactory<GabbianiModel, base, base::InitParams> ; 00078 typedef register_factory<GabbianiModel, base, base::InitParams> my_factory ; 00079 static my_factory register_me ; 00080 00081 /// Private constructor because this model is instantiated using a 00082 /// factory and accessed solely through the interface provided by its 00083 /// abstract base class. 00084 GabbianiModel(const base::InitParams&) ; 00085 00086 /// These methods perform the LGMD computations. 00087 ///@{ 00088 void update() ; 00089 public: 00090 static float spike_rate(float tti) ; 00091 ///@} 00092 00093 /// Destructor 00094 private: 00095 ~GabbianiModel() ; 00096 00097 // This inner class encapsulates various parameters that can be used 00098 // to tweak different aspects of the LGMD model implemented by the 00099 // GabbianiModel class. 00100 class Params : public singleton<Params> { 00101 // Initialization 00102 Params() ; // private because this is a singleton 00103 friend class singleton<Params> ; 00104 00105 /// Gabbiani's multiplicative model of the LGMD correlates this 00106 /// neuron's firing rate with the product of a logarithmic and an 00107 /// exponential term with a constant of proportionality thrown in. 00108 float m_C ; 00109 00110 /// The model uses a pair of parameters, viz., alpha and delta, for 00111 /// some reason. FIXME! WHY DO WE NEED THESE PARAMS? WHAT DO THEY 00112 /// MEAN? 00113 float m_alpha, m_delta ; 00114 00115 /// According to Gabbiani, et al. the LGMD firing rate is strongly 00116 /// correlated to the ratio of the half-size of the approaching 00117 /// object and its velocity. This ratio is a time 00118 /// (length/velocity). This is the time it takes for the 00119 /// approaching object to cover a distance equal to its own (half) 00120 /// size. 00121 float m_l_over_v ; 00122 00123 /// To better simulate LGMD spikes generated by actual locusts, we 00124 /// can corrupt the "ideal" spikes generated by the Gabbiani model 00125 /// with some Gaussian noise. This parameter specifies the standard 00126 /// deviation to use for the spike noise. 00127 float m_sigma ; 00128 00129 public: 00130 // Accessing the various parameters 00131 static float C() {return instance().m_C ;} 00132 static float alpha() {return instance().m_alpha ;} 00133 static float delta() {return instance().m_delta ;} 00134 static float sigma() {return instance().m_sigma ;} 00135 static float l_over_v() {return instance().m_l_over_v ;} 00136 00137 // Clean-up 00138 ~Params() ; 00139 } ; 00140 } ; 00141 00142 //----------------------------------------------------------------------- 00143 00144 } // end of namespace encapsulating this file's definitions 00145 00146 #endif 00147 00148 /* So things look consistent in everyone's emacs... */ 00149 /* Local Variables: */ 00150 /* indent-tabs-mode: nil */ 00151 /* End: */