DescriptorVec.H

Go to the documentation of this file.
00001 /*!@file Channels/DescriptorVec.H descriptor vector generator for obj rec */
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: Lior Elazary <elazary@usc.edu>
00034 // $HeadURL: svn://isvn.usc.edu/software/invt/trunk/saliency/src/Channels/DescriptorVec.H $
00035 // $Id: DescriptorVec.H 9412 2008-03-10 23:10:15Z farhan $
00036 //
00037 
00038 #ifndef DESCRIPTORVEC_H_DEFINED
00039 #define DESCRIPTORVEC_H_DEFINED
00040 
00041 #include "Channels/InputFrame.H"
00042 #include "Channels/ComplexChannel.H"
00043 #include "Channels/SingleChannel.H"
00044 #include "Component/ModelComponent.H"
00045 #include "Component/ModelParam.H"
00046 #include "Image/Pixels.H"
00047 #include "Image/Image.H"
00048 #include "SIFT/VisualObjectMatchAlgo.H"
00049 #include "SIFT/Histogram.H"
00050 #include "Image/FourierEngine.H"
00051 
00052 
00053 // ######################################################################
00054 //! Descriptor vector class
00055 class DescriptorVec : public ModelComponent
00056 {
00057 public:
00058   //! Constructor, need complex channel
00059   DescriptorVec(OptionManager& mgr,
00060                 const std::string& descrName,
00061                 const std::string& tagName,
00062                 ComplexChannel *cc );
00063 
00064   //! Destructor
00065   virtual ~DescriptorVec();
00066 
00067   //! Set the input image
00068   void setInputImg(const Image<PixRGB<byte> >& img);
00069 
00070   //! Set the fovea location to create the descriptor vector
00071   void setFovea(Point2D<int> loc);
00072 
00073   //! Get the fovea dims
00074   Dims getFoveaSize();
00075 
00076   //! Set the fovea dims
00077   void setFoveaSize(Dims &d);
00078 
00079   //! Set the fovea dims
00080   void setFoveaSize(int foveaRadius);
00081 
00082   //! Get the image under the fovea
00083   Image<PixRGB<byte> > getFoveaImage();
00084 
00085   //! Return the image of the histogram under the fovea
00086   Image<PixRGB<byte> > getHistogramImage();
00087 
00088   //! Build a SIFT descriptor from the the location of the fovea
00089   void buildSIFTDV();
00090 
00091   //! Build a particle count descriptor from the the location of the fovea
00092   void buildParticleCountDV();
00093 
00094   //! Build a Fourier Transform descriptor from the the location of the fovea
00095   void buildFftDV();
00096 
00097   //! Build a descriptor vector from the location of the fovea (complex channel)
00098   void buildDV();
00099 
00100   //! Build a descriptor vector from the location of the fovea (complex channel raw submaps)
00101   void buildRawDV();
00102 
00103   void buildLocalDV();
00104 
00105   //! Build a feature vector from a single channel
00106   void buildSingleChannelFV(SingleChannel &sc);
00107 
00108   //! Get the feature vector from the descriptor vector
00109   const std::vector<double>& getFV() const;
00110 
00111   //! Get the size of the feature vector
00112   uint getFVSize();
00113 
00114 private:
00115 
00116   // Get the dominate orientation in the image
00117   // based on Lowes SIFT alg
00118   float getDominateOrientation(const Image<float> &img);
00119 
00120 protected:
00121   ComplexChannel *itsComplexChannel;
00122   OModelParam<Dims> itsFoveaSize;    //! The size of our fovea
00123   Point2D<int> itsFoveaLoc;               //! THe location of the fovea
00124   Point2D<int> itsAttentionLoc;               //! THe location of the attention point
00125   Image<PixRGB<byte> > itsFoveaImg;  //! the image to the fovea
00126   Image<PixRGB<byte> > itsInputImg;  //! the input image
00127   Histogram     itsFeatureHistogram; //! The feature histogram
00128   mutable FourierEngine<double>* itsFEngine;
00129   Image<complexd> itsFTImg;
00130   std::vector<double> itsFV;         //! Our feature vector
00131 
00132   //!The feature vector computed, multidementional for each keypoint found
00133   //  std::vector<std::vector<double> > itsDescriptorVec;
00134 };
00135 
00136 #endif
00137 
00138 // ######################################################################
00139 /* So things look consistent in everyone's emacs... */
00140 /* Local Variables: */
00141 /* indent-tabs-mode: nil */
00142 /* End: */
Generated on Sun May 8 08:40:21 2011 for iLab Neuromorphic Vision Toolkit by  doxygen 1.6.3