00001 /*! 00002 \file Neuro/GistEstimatorContextBased.H 00003 \brief Implementation of ``Context-based vision system for place and 00004 object recognition'' by Torralba, et al. 00005 00006 The GistEstimatorContextBased class implements (within the INVT 00007 framework) the gist related portions of the following paper: 00008 00009 Torralba, A., Murphy, K. P., Freeman, W. T., Rubin, M. A. 00010 Context-based vision system for place and object recognition. 00011 Ninth IEEE International Conference on Computer Vision, 00012 1:273--280, 2003. 00013 00014 In the paper, the authors use a wavelet image decomposition tuned to 6 00015 orientations and 4 scales to compute texture features. However, this 00016 class uses Gabor filters (with the same number of orientations and 00017 scales) because INVT readily provides them and, as per the authors, 00018 the two approaches produce similar results. 00019 00020 To compute the gist vector for an image, we apply the 24 Gabor 00021 filters and then subdivide each resulting image into a 4x4 grid. Then, 00022 we compute the mean pixel value in each grid. This gives us 16 numbers 00023 per filter. Since there are 24 filters in all, we get 16x24 = 384 00024 numbers per image. These 384 numbers form the gist vector for the 00025 input image. 00026 */ 00027 00028 // //////////////////////////////////////////////////////////////////// // 00029 // The iLab Neuromorphic Vision C++ Toolkit - Copyright (C) 2000-2005 // 00030 // by the University of Southern California (USC) and the iLab at USC. // 00031 // See http://iLab.usc.edu for information about this project. // 00032 // //////////////////////////////////////////////////////////////////// // 00033 // Major portions of the iLab Neuromorphic Vision Toolkit are protected // 00034 // under the U.S. patent ``Computation of Intrinsic Perceptual Saliency // 00035 // in Visual Environments, and Applications'' by Christof Koch and // 00036 // Laurent Itti, California Institute of Technology, 2001 (patent // 00037 // pending; application number 09/912,225 filed July 23, 2001; see // 00038 // http://pair.uspto.gov/cgi-bin/final/home.pl for current status). // 00039 // //////////////////////////////////////////////////////////////////// // 00040 // This file is part of the iLab Neuromorphic Vision C++ Toolkit. // 00041 // // 00042 // The iLab Neuromorphic Vision C++ Toolkit is free software; you can // 00043 // redistribute it and/or modify it under the terms of the GNU General // 00044 // Public License as published by the Free Software Foundation; either // 00045 // version 2 of the License, or (at your option) any later version. // 00046 // // 00047 // The iLab Neuromorphic Vision C++ Toolkit is distributed in the hope // 00048 // that it will be useful, but WITHOUT ANY WARRANTY; without even the // 00049 // implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR // 00050 // PURPOSE. See the GNU General Public License for more details. // 00051 // // 00052 // You should have received a copy of the GNU General Public License // 00053 // along with the iLab Neuromorphic Vision C++ Toolkit; if not, write // 00054 // to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, // 00055 // Boston, MA 02111-1307 USA. // 00056 // //////////////////////////////////////////////////////////////////// // 00057 // 00058 // Primary maintainer for this file: Manu Viswanathan <mviswana at usc dot edu> 00059 // $HeadURL: svn://isvn.usc.edu/software/invt/trunk/saliency/src/Neuro/GistEstimatorContextBased.H $ 00060 // $Id: GistEstimatorContextBased.H 11104 2009-04-13 18:36:37Z lzc $ 00061 // 00062 00063 #ifndef NEURO_GIST_ESTIMATOR_CONTEXT_BASED_H_DEFINED 00064 #define NEURO_GIST_ESTIMATOR_CONTEXT_BASED_H_DEFINED 00065 00066 //------------------------------ HEADERS -------------------------------- 00067 00068 // Gist specific headers 00069 #include "Neuro/GistEstimator.H" 00070 00071 // Other INVT headers 00072 #include "Neuro/NeuroSimEvents.H" 00073 00074 // Standard C++ headers 00075 #include <string> 00076 00077 //------------------------- CLASS DEFINITION ---------------------------- 00078 00079 /*! 00080 \class GistEstimatorContextBased 00081 \brief Gist estimator for ``Context-based vision system...'' by 00082 Torralba, et al. 00083 00084 This class computes the gist vector for an input image using the 00085 technique described in section 2 of ``Context-based vision system for 00086 place and object recognition'' by Torralba, et al. 00087 00088 In their paper, the authors apply 24 filters to the image (6 00089 orientations, 4 scales) and average the results over 4x4 grids to get 00090 a total of 384 texture features which comprise the gist vector. This 00091 class computes and returns this vector of 384 numbers. 00092 */ 00093 class GistEstimatorContextBased : public GistEstimatorAdapter { 00094 public: 00095 static const uint NUM_ORIENTATIONS = 6 ; 00096 static const uint NUM_SCALES = 4 ; 00097 static const uint NUM_FILTERS = NUM_ORIENTATIONS * NUM_SCALES ; 00098 static const uint GRID_SIZE = 4 ; 00099 static const uint NUM_FEATURES = GRID_SIZE * GRID_SIZE * NUM_FILTERS ; 00100 00101 typedef float PixelType ; 00102 typedef Image<PixelType> ImageType ; 00103 00104 //! The constructor expects to be passed an option manager, which it 00105 //! uses to set itself up in the INVT simulation framework. 00106 GistEstimatorContextBased(OptionManager& mgr, 00107 const std::string& descrName = 00108 "GistEstimatorContextBased", 00109 const std::string& tagName = 00110 "GistEstimatorContextBased") ; 00111 virtual ~GistEstimatorContextBased() ; 00112 00113 //! This method returns the gist vector computed for the input image. 00114 //! The gist vector consists of 384 numbers that are obtained by 00115 //! averaging the pixel values in each of the 16 subimages of each of 00116 //! the 24 filteration results. 00117 Image<double> getGist() ; 00118 00119 protected: 00120 //! Callback for when new data is available from Visuc=alCortex 00121 SIMCALLBACK_DECLARE(GistEstimatorContextBased, SimEventVisualCortexOutput); 00122 00123 private : 00124 Image<double> itsGistVector ; // gist feature vector 00125 } ; 00126 00127 //-------------------- INLINE FUNCTION DEFINITIONS ---------------------- 00128 00129 inline Image<double> GistEstimatorContextBased::getGist() 00130 { 00131 return itsGistVector ; 00132 } 00133 00134 //----------------------------------------------------------------------- 00135 00136 /* So things look consistent in everyone's emacs... */ 00137 /* Local Variables: */ 00138 /* indent-tabs-mode: nil */ 00139 /* End: */ 00140 00141 #endif