Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

ShapeEstimator.H

Go to the documentation of this file.
00001 /*!@file Neuro/ShapeEstimator.H Estimate the shape/size of an attended object */
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: Dirk Walther <walther>
00034 // $HeadURL: svn://isvn.usc.edu/software/invt/trunk/saliency/src/Neuro/ShapeEstimator.H $
00035 // $Id: ShapeEstimator.H 10834 2009-02-12 01:34:32Z itti $
00036 //
00037 
00038 #ifndef SHAPEESTIMATOR_H_DEFINED
00039 #define SHAPEESTIMATOR_H_DEFINED
00040 
00041 #include "Component/ModelComponent.H"
00042 #include "Component/ModelParam.H"
00043 #include "Simulation/SimModule.H"
00044 #include "Image/Image.H"
00045 #include "Neuro/NeuroSimEvents.H"
00046 #include "Neuro/ShapeEstimatorModes.H"
00047 #include "Simulation/SimEvents.H"
00048 #include <string>
00049 
00050 class VisualCortex;
00051 class SpatialMetrics;
00052 
00053 //! everything realted to the shape estimation procedure
00054 /*! class to take care of all things related to the shape estimation
00055   procedure published in Walther et al, BMCV 02 */
00056 class ShapeEstimator : public SimModule
00057 {
00058 public:
00059 
00060   //! Constructor
00061   /*! @param vcx this is the hook for the class to obtain its information
00062     on channels, submaps etc. */
00063   ShapeEstimator(OptionManager& mgr,
00064                  const std::string& descrName = "Shape Estimator",
00065                  const std::string& tagName = "shapeestimator",
00066                  const nub::soft_ref<VisualCortex> vcx =
00067                  nub::soft_ref<VisualCortex>());
00068 
00069 protected:
00070   //! Callback for when a new WTA winner is available
00071   SIMCALLBACK_DECLARE(ShapeEstimator, SimEventWTAwinner);
00072 
00073   //! Callback for every time we should save our outputs
00074   SIMCALLBACK_DECLARE(ShapeEstimator, SimEventSaveOutput);
00075 
00076   //!< metrics that depend on the input size:
00077   nub::ref<SpatialMetrics> itsMetrics;
00078 
00079   //! Text log file name
00080   OModelParam<std::string> itsLogFile;
00081 
00082   //! Determines what information is used as a source for the shape estimation
00083   /*! possible values:<ul><li>"None" - shape estimator is not used;
00084     <li>"FeatureMap" - the shape is extracted from the winning Feature Map;
00085     <li>"ConspicuityMap" - shape is extracted from the winning Conspicuity Map;
00086     <li>"SaliencyMap" - the shape is extracted from the Saliency Map</ul>*/
00087   OModelParam<ShapeEstimatorMode> itsMode;
00088 
00089   //! Determines Smoothing Method used to extract a map in image coordinates
00090   /*! possible values:<ul>
00091     <li>"None" - no smoothing, the result is just scaled up in blocks;
00092     <li>"Gaussian" - smoothing by convolving with a large 2D Gaussian kernel;
00093     <li>"Chamfer" - smoothing with Opening and Chamfering (takes about half
00094     the time compared to "Gaussian"</ul>*/
00095   OModelParam<ShapeEstimatorSmoothMethod> itsSmMethod;
00096 
00097   //! Save our internals?
00098   OModelParam<bool> itsSaveObjMask;
00099 
00100   //! use a larger neighborhood when tracking down a local max?
00101   OModelParam<bool> itsUseLargeNeigh;
00102 
00103   //! Reset ShapeEstimator
00104   /*! See the base function in ModelComponent.H for info. */
00105   virtual void reset1();
00106 
00107 private:
00108   // Locate a local max in submap (any size smaller than input size)
00109   // around winner (given in coordinates of an image of dims indims)
00110   // and returns the matching coordinates in submap's resolution as
00111   // well as the value at the max.
00112   float locateLocalMax(const Image<float>& submap, const Point2D<int>& winner,
00113                        const Dims& indims, Point2D<int>& winloc);
00114 
00115   // the structuring element for eroding and dilating
00116   // for the chamfer smoothing method
00117   Image<byte> structEl;
00118 
00119   // keep a copy of our last smooth mask so we can save it
00120   Image<float> itsSmoothMask;
00121 
00122   // our cumulative smooth mask
00123   Image<float> itsCumMask;
00124 };
00125 
00126 #endif
00127 
00128 
00129 // ######################################################################
00130 /* So things look consistent in everyone's emacs... */
00131 /* Local Variables: */
00132 /* indent-tabs-mode: nil */
00133 /* End: */

Generated on Sun Nov 22 13:42:45 2009 for iLab Neuromorphic Vision Toolkit by  doxygen 1.4.4