ImageInfo.H

00001 // //////////////////////////////////////////////////////////////////// //
00002 // The iLab Neuromorphic Vision C++ Toolkit - Copyright (C) 2000-2005   //
00003 // by the University of Southern California (USC) and the iLab at USC.  //
00004 // See http://iLab.usc.edu for information about this project.          //
00005 // //////////////////////////////////////////////////////////////////// //
00006 // Major portions of the iLab Neuromorphic Vision Toolkit are protected //
00007 // under the U.S. patent ``Computation of Intrinsic Perceptual Saliency //
00008 // in Visual Environments, and Applications'' by Christof Koch and      //
00009 // Laurent Itti, California Institute of Technology, 2001 (patent       //
00010 // pending; application number 09/912,225 filed July 23, 2001; see      //
00011 // http://pair.uspto.gov/cgi-bin/final/home.pl for current status).     //
00012 // //////////////////////////////////////////////////////////////////// //
00013 // This file is part of the iLab Neuromorphic Vision C++ Toolkit.       //
00014 //                                                                      //
00015 // The iLab Neuromorphic Vision C++ Toolkit is free software; you can   //
00016 // redistribute it and/or modify it under the terms of the GNU General  //
00017 // Public License as published by the Free Software Foundation; either  //
00018 // version 2 of the License, or (at your option) any later version.     //
00019 //                                                                      //
00020 // The iLab Neuromorphic Vision C++ Toolkit is distributed in the hope  //
00021 // that it will be useful, but WITHOUT ANY WARRANTY; without even the   //
00022 // implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      //
00023 // PURPOSE.  See the GNU General Public License for more details.       //
00024 //                                                                      //
00025 // You should have received a copy of the GNU General Public License    //
00026 // along with the iLab Neuromorphic Vision C++ Toolkit; if not, write   //
00027 // to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,   //
00028 // Boston, MA 02111-1307 USA.                                           //
00029 // //////////////////////////////////////////////////////////////////// //
00030 //
00031 // Primary maintainer for this file: Lior Elazary <elazary@usc.edu>
00032 // $HeadURL: svn://isvn.usc.edu/software/invt/trunk/saliency/src/Apps/BorderWatch/ImageInfo.H $
00033 // $Id: ImageInfo.H 12962 2010-03-06 02:13:53Z irock $
00034 //
00035 
00036 
00037 #ifndef IMAGEINFO_H_DEFINED
00038 #define IMAGEINFO_H_DEFINED
00039 
00040 #include "Component/ModelComponent.H"
00041 #include "Component/ModelOptionDef.H"
00042 #include "Component/ModelParam.H"
00043 #include "Image/Image.H"
00044 #include "Image/MathOps.H"
00045 #include "Image/Pixels.H"
00046 #include "Image/PixelsTypes.H"
00047 #include "Image/Point2D.H"
00048 #include "Neuro/VisualCortexConfigurator.H"
00049 #include "Simulation/SimModule.H"
00050 
00051 #include <vector>
00052 
00053 class SimEventQueue;
00054 
00055 //! Monitor an image over time, to detect interesting events
00056 class ImageInfo : public SimModule
00057 {
00058 public:
00059   //! Various statistical measures of interestingness returned by this object
00060   struct ImageStats
00061   {
00062     Image<float> smap;
00063     float saliency;
00064     Point2D<int> salpoint;
00065     float energy;
00066     float uniqueness;
00067     float entropy;
00068     float rand;
00069     float KLsurprise;
00070     float MSDsurprise;
00071     Image<float> belief1;
00072     Image<float> belief2;
00073 
00074     float score;  // compound score combining all above metrics
00075   };
00076 
00077   //! Constructor
00078   ImageInfo(OptionManager& mgr,
00079             const std::string& descrName = "ImageInfo", const std::string& tagName = "ImageInfo");
00080 
00081   //! Destructor
00082   virtual ~ImageInfo();
00083 
00084   // Recompute the score of the chip by passing it a new image to process
00085   ImageStats update(nub::ref<SimEventQueue>& q, const Image<PixRGB<byte> >& img, const int frameID);
00086 
00087 private:
00088   // Apply a kalman filter to the input image and set a mu and sigma belief image
00089   float integrateData(const Image<float> &data, const float R, const float Q,
00090                       Image<float>& bel_mu, Image<float>& bel_sig);
00091 
00092   Image<float> itsBelief1Mu;    // Mean and variance maps over two timescales uses to compute
00093   Image<float> itsBelief1Sig;   //    the probability of a target
00094   Image<float> itsBelief2Mu;    //
00095   Image<float> itsBelief2Sig;   //
00096 
00097   // Compute a mean square difference between the previous saliency map and the current one
00098   float updateMSDiff(const Image<PixRGB<byte> >& img, Image<float> salMap);
00099 
00100   nub::ref<VisualCortexConfigurator> itsVcc;          // The visual cortex component
00101 
00102   Image<float> itsPrevSmap; // The previous saliency map - used by Bruce's MSDiff algorithm
00103 
00104   OModelParam<float> itsRandGain;         // The final score is computed as a sum of products of the
00105   OModelParam<float> itsEntropyGain;      //    individual metrics and these coefficients
00106   OModelParam<float> itsSaliencyGain;
00107   OModelParam<float> itsUniquenessGain;
00108   OModelParam<float> itsMSDSurpriseGain;
00109   OModelParam<float> itsKLSurpriseGain;
00110 };
00111 
00112 #endif
00113 
00114 
Generated on Sun May 8 08:40:11 2011 for iLab Neuromorphic Vision Toolkit by  doxygen 1.6.3