GistEstimatorStd.C

Go to the documentation of this file.
00001 /*!@file Neuro/GistEstimatorStd.C extract estimated gist
00002          using available features of the image                          */
00003 // //////////////////////////////////////////////////////////////////// //
00004 // The iLab Neuromorphic Vision C++ Toolkit - Copyright (C) 2001 by the //
00005 // 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: Christian Siagian <siagian@usc.edu>
00034 // $HeadURL: svn://isvn.usc.edu/software/invt/trunk/saliency/src/Neuro/GistEstimatorStd.C $
00035 // $Id: GistEstimatorStd.C 14596 2011-03-14 17:32:24Z sophie $
00036 //
00037 
00038 // ######################################################################
00039 /*! Extract gist of image                                               */
00040 
00041 #include "Neuro/GistEstimatorStd.H"
00042 
00043 #include "Component/ModelManager.H"
00044 #include "Channels/ChannelMaps.H"
00045 //#include "Channels/BlueYellowChannel.H"
00046 //#include "Channels/ColorChannel.H"
00047 //#include "Channels/GaborChannel.H"
00048 //#include "Channels/IntensityChannel.H"
00049 //#include "Channels/OrientationChannel.H"
00050 //#include "Channels/RedGreenChannel.H"
00051 #include "GUI/XWinManaged.H"
00052 #include "Image/CutPaste.H"
00053 #include "Image/DrawOps.H"
00054 #include "Image/FilterOps.H"
00055 #include "Image/MathOps.H"
00056 #include "Image/ShapeOps.H"
00057 #include "Neuro/gistParams.H"
00058 #include "Raster/Raster.H"
00059 
00060 #include "Simulation/SimEventQueue.H"
00061 #include "Neuro/NeuroSimEvents.H"
00062 #include "Simulation/SimEvents.H"
00063 #include "Channels/ChannelOpts.H"
00064 #include "Channels/SingleChannel.H"
00065 
00066 #include "Util/Timer.H"
00067 #include "Util/StringUtil.H"
00068 
00069 
00070 // ######################################################################
00071 GistEstimatorStd::GistEstimatorStd(OptionManager& mgr,
00072                                    const std::string& descrName,
00073                                    const std::string& tagName) :
00074   GistEstimatorAdapter(mgr, descrName, tagName),
00075   SIMCALLBACK_INIT(SimEventVisualCortexOutput),
00076   itsRawGistEstimStd(new RawGistEstimatorStd(mgr)) 
00077 {
00078   itsGistVector.resize(1,NUM_GIST_FEAT * NUM_GIST_CHAN, NO_INIT);
00079   ////mgr.setOptionValString(&OPT_SingleChannelComputeFullPyramidForGist, "true");
00080  addSubComponent(itsRawGistEstimStd);
00081 }
00082 
00083 // ######################################################################
00084 GistEstimatorStd::~GistEstimatorStd()
00085 { }
00086 
00087 
00088 // ######################################################################
00089 void GistEstimatorStd::
00090 onSimEventVisualCortexOutput(SimEventQueue& q, rutz::shared_ptr<SimEventVisualCortexOutput>& e)
00091 {
00092   //Grab the channel maps from the visual cortex
00093   rutz::shared_ptr<SimReqVCXmaps> vcxm(new SimReqVCXmaps(this));
00094   q.request(vcxm); // VisualCortex is now filling-in the maps...
00095   rutz::shared_ptr<ChannelMaps> chm = vcxm->channelmaps();
00096 
00097   //Compute the full size gist feature vector
00098   Image<float> GistVect;
00099   GistVect = itsRawGistEstimStd->compute(chm);
00100   itsGistVector = GistVect;
00101 
00102 
00103   // post an event so that anyone interested in gist can grab it:
00104   rutz::shared_ptr<SimEventGistOutput>
00105     ew(new SimEventGistOutput(this, itsGistVector)); //GistVect)); //itsGistVector));
00106   q.post(ew);
00107 }
00108 
00109 // ######################################################################
00110 Image<double> GistEstimatorStd::getGist()
00111 {
00112    return itsGistVector;
00113 }
00114 
00115 // ######################################################################
00116 void GistEstimatorStd::start1()
00117 {
00118   getManager().setOptionValString(&OPT_SingleChannelComputeFullPyramidForGist,"true");
00119   GistEstimatorAdapter::start1();
00120 }
00121 
00122 
00123 // ######################################################################
00124 /* So things look consistent in everyone's emacs... */
00125 /* Local Variables: */
00126 /* indent-tabs-mode: nil */
00127 /* End: */
Generated on Sun May 8 08:41:03 2011 for iLab Neuromorphic Vision Toolkit by  doxygen 1.6.3