00001 /*!@file Neuro/getSaliency.H Interface for obtaining lists of salient locations */ 00002 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: Dirk Walther <walther@caltech.edu> 00034 // $HeadURL: svn://isvn.usc.edu/software/invt/trunk/saliency/src/Neuro/getSaliency.H $ 00035 // $Id: getSaliency.H 12962 2010-03-06 02:13:53Z irock $ 00036 // 00037 00038 #ifndef GETSALIENCY_H_DEFINED 00039 #define GETSALIENCY_H_DEFINED 00040 00041 #include "Image/Image.H" 00042 #include "Neuro/StdBrain.H" 00043 #include "Neuro/NeuroSimEvents.H" 00044 #include "Simulation/SimEventQueue.H" 00045 #include <vector> 00046 00047 //simple struct to store a submap and its name 00048 00049 typedef struct /// this should now be a NamedImage<float> 00050 { 00051 Image<float> itsSubMap; 00052 std::string itsSubMapName; 00053 } subMap; 00054 00055 00056 00057 //! This class allows for easy access to the list of salient points in an image 00058 /*! It uses the Brain class in order to create a list of the coordinates and 00059 evolution times for the salient spots of an image. */ 00060 class GetSaliency : public StdBrain { 00061 public: 00062 00063 //! Constructor 00064 GetSaliency(OptionManager& mgr); 00065 00066 //! Destructor 00067 ~GetSaliency(); 00068 00069 //! Compute the table of salient spots 00070 /*! Required parameters: 00071 @param inp input color image 00072 @param targets binary map of the same size as the input, in which 00073 targets for the focus of attention are 255 and the rest is 00074 zero. Pass an uninitialized image if you have no targets to look for. 00075 @return The number of salient spots found within max_time seconds. */ 00076 const int compute(const Image< PixRGB<byte> >& img, 00077 const SimTime& max_time); 00078 00079 //! Returns the initial saliency map <B>prior</B> to the evolution. 00080 /*! Should be called after compute. 00081 @return The saliency map prior to the evolutions, normalized 00082 between 0.0 and 1.0 - the size is the same as the input image.*/ 00083 const Image<float>& getSalmap(); 00084 00085 00086 //! Returns the coordinates of the salient spots. 00087 /*!@return A vector of Point2D<int> objects - the x and y coordinates of 00088 the salient spots.*/ 00089 const std::vector<Point2D<int> >& getCoords(); 00090 00091 00092 //! Returns the evolution times. 00093 /*!@return A vector of <TT>double</TT> numbers that contains the 00094 evolution times for the salient spots. */ 00095 const std::vector<SimTime>& getTimes(); 00096 00097 //!Returns the submaps 00098 const std::vector<subMap>& getSubMaps(); 00099 00100 //!Return the vc map 00101 Image<float> getVCXmap(const Image<PixRGB<byte> > &img); 00102 00103 00104 protected: 00105 //! Callback for when a new attention shift occurs 00106 SIMCALLBACK_DECLARE(GetSaliency, SimEventWTAwinner); 00107 00108 nub::ref<SimEventQueue> itsQ; 00109 Image<float> itsSalmap; 00110 std::vector<Point2D<int> > itsCoords; 00111 std::vector<SimTime> itsTimes; 00112 std::vector<subMap> itsSubMaps; 00113 00114 }; 00115 00116 #endif 00117 00118 // ###################################################################### 00119 /* So things look consistent in everyone's emacs... */ 00120 /* Local Variables: */ 00121 /* indent-tabs-mode: nil */ 00122 /* End: */