LTI-Lib latest version v1.9 - last update 10 Apr 2010

ltiFeatureSaliencyAx.h

00001 /*
00002  * Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006
00003  * Lehrstuhl fuer Technische Informatik, RWTH-Aachen, Germany
00004  *
00005  * This file is part of the LTI-Computer Vision Library (LTI-Lib)
00006  *
00007  * The LTI-Lib is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU Lesser General Public License (LGPL)
00009  * as published by the Free Software Foundation; either version 2.1 of
00010  * the License, or (at your option) any later version.
00011  *
00012  * The LTI-Lib is distributed in the hope that it will be
00013  * useful, but WITHOUT ANY WARRANTY; without even the implied warranty
00014  * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  * GNU Lesser General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU Lesser General Public
00018  * License along with the LTI-Lib; see the file LICENSE.  If
00019  * not, write to the Free Software Foundation, Inc., 59 Temple Place -
00020  * Suite 330, Boston, MA 02111-1307, USA.
00021  */
00022 
00023 
00024 /*----------------------------------------------------------------
00025  * project ....: LTI Digital Image/Signal Processing Library
00026  * file .......: ltiFeatureSaliencyAx.h
00027  * authors ....: Pablo Alvarado
00028  * organization: LTI, RWTH Aachen
00029  * creation ...: 23.2.2001
00030  * revisions ..: $Id: ltiFeatureSaliencyAx.h,v 1.8 2006/02/08 11:08:01 ltilib Exp $
00031  */
00032 
00033 #ifndef _LTI_FEATURE_SALIENCY_AX_H_
00034 #define _LTI_FEATURE_SALIENCY_AX_H_
00035 
00036 #include "ltiSaliency.h"
00037 #include "ltiPyramid.h"
00038 #include "ltiImage.h"
00039 #include <list>
00040 
00041 namespace lti {
00042   /**
00043    * Feature saliency map for AXIOM.
00044    *
00045    * The feature saliency map generate a channel, where the pixel
00046    * values represent "saliency" factors, i.e. how conspicous is the
00047    * pixel respect its neighbourhood.
00048    *
00049    * This implementation has the same principles of the Itti and Koch
00050    * saliency map, but the implementation is different, to allow a
00051    * faster calculation of the conspicous regions, interesting for the
00052    * object recognition.
00053    *
00054    * The name Ax is related with the Project AXIOM at the Chair of
00055    * Technical Computer Science (LTI), for which this functor was
00056    * developed.
00057    */
00058   class featureSaliencyAx : public saliency {
00059   public:
00060     /**
00061      * the parameters for the class featureSaliencyAx
00062      */
00063     class parameters : public saliency::parameters {
00064     public:
00065       /**
00066        * default constructor
00067        */
00068       parameters();
00069 
00070       /**
00071        * copy constructor
00072        * @param other the parameters object to be copied
00073        */
00074       parameters(const parameters& other);
00075 
00076       /**
00077        * destructor
00078        */
00079       ~parameters();
00080 
00081       /**
00082        * returns name of this type
00083        */
00084       const char* getTypeName() const;
00085 
00086       /**
00087        * copy the contents of a parameters object
00088        * @param other the parameters object to be copied
00089        * @return a reference to this parameters object
00090        */
00091       parameters& copy(const parameters& other);
00092 
00093       /**
00094        * copy the contents of a parameters object
00095        * @param other the parameters object to be copied
00096        * @return a reference to this parameters object
00097        */
00098       parameters& operator=(const parameters& other);
00099 
00100 
00101       /**
00102        * returns a pointer to a clone of the parameters
00103        */
00104       virtual functor::parameters* clone() const;
00105 
00106       /**
00107        * write the parameters in the given ioHandler
00108        * @param handler the ioHandler to be used
00109        * @param complete if true (the default) the enclosing begin/end will
00110        *        be also written, otherwise only the data block will be written.
00111        * @return true if write was successful
00112        */
00113       virtual bool write(ioHandler& handler,const bool complete=true) const;
00114 
00115       /**
00116        * write the parameters in the given ioHandler
00117        * @param handler the ioHandler to be used
00118        * @param complete if true (the default) the enclosing begin/end will
00119        *        be also written, otherwise only the data block will be written.
00120        * @return true if write was successful
00121        */
00122       virtual bool read(ioHandler& handler,const bool complete=true);
00123 
00124 #     ifdef _LTI_MSC_6
00125       /**
00126        * this function is required by MSVC only, as a workaround for a
00127        * very awful bug, which exists since MSVC V.4.0, and still by
00128        * V.6.0 with all bugfixes (so called "service packs") remains
00129        * there...  This method is also public due to another bug, so please
00130        * NEVER EVER call this method directly: use read() instead
00131        */
00132       bool readMS(ioHandler& handler,const bool complete=true);
00133 
00134       /**
00135        * this function is required by MSVC only, as a workaround for a
00136        * very awful bug, which exists since MSVC V.4.0, and still by
00137        * V.6.0 with all bugfixes (so called "service packs") remains
00138        * there...  This method is also public due to another bug, so please
00139        * NEVER EVER call this method directly: use write() instead
00140        */
00141       bool writeMS(ioHandler& handler,const bool complete=true) const;
00142 #     endif
00143 
00144       // ------------------------------------------------
00145       // the parameters
00146       // ------------------------------------------------
00147 
00148       //TODO: comment the parameters of your functor
00149       // If you add more parameters manually, do not forget to do following:
00150       // 1. indicate in the default constructor the default values
00151       // 2. make sure that the copy member also copy your new parameters
00152       // 3. make sure that the read and write members also read and
00153       //    write your parameters
00154 
00155 
00156       /**
00157        * This is the maximal number of levels to be considered in the
00158        * multiresolutional analysis of the image.
00159        *
00160        * The color/intensity/orientation analysis will be
00161        * done only in the "important" resolutions detected by the
00162        * Kullback-Contrast analysis, which consider the   Default value: 256
00163        */
00164       int levels;
00165 
00166       /**
00167        * to calculate which resolutions are important a histogram can
00168        * be used as probability distribution to evaluate the
00169        * similarity, or the channel itself can be somehow considered
00170        * as a probability distribution.  If useHistogram is true
00171        * (default), the histogram will be used.
00172        */
00173       bool useHistogram;
00174 
00175       /**
00176        * calculate the conspicuity map based on the intensity
00177        */
00178       bool doIntensity;
00179 
00180       /**
00181        * calculate the conspicuity map based on color
00182        */
00183       bool doColor;
00184 
00185       /**
00186        * calculate the conspicuity map based on orientation
00187        */
00188       bool doOrientation;
00189     };
00190 
00191     /**
00192      * default constructor
00193      */
00194     featureSaliencyAx();
00195 
00196     /**
00197      * copy constructor
00198      * @param other the object to be copied
00199      */
00200     featureSaliencyAx(const featureSaliencyAx& other);
00201 
00202     /**
00203      * destructor
00204      */
00205     virtual ~featureSaliencyAx();
00206 
00207     /**
00208      * returns the name of this type ("featureSaliencyAx")
00209      */
00210     virtual const char* getTypeName() const;
00211 
00212     /**
00213      * generate the saliency map for the given image
00214      * @param src image with the source data.
00215      * @param map the resulting saliency map
00216      * @return true if successful, false otherwise.
00217      */
00218     bool apply(const image& src,channel& map);
00219 
00220     /**
00221      * generate the saliency map for the given image
00222      * @param src image with the source data.
00223      * @param conspIntensity the conspicuity map based on intensity
00224      * @param conspColor conspicuity map based on color
00225      * @param conspOrientation conspicuity map based on orientation
00226      * @param map the resulting saliency map
00227      * @return true if successful, false otherwise.
00228      */
00229     bool apply(const image& src,
00230                channel& conspIntensity,
00231                channel& conspColor,
00232                channel& conspOrientation,
00233                channel& map);
00234 
00235     /**
00236      * get the most important resolutions used in the last apply method
00237      */
00238     const std::list<int>& getResolutions() const;
00239 
00240     /**
00241      * copy data of "other" functor.
00242      * @param other the functor to be copied
00243      * @return a reference to this functor object
00244      */
00245     featureSaliencyAx& copy(const featureSaliencyAx& other);
00246 
00247     /**
00248      * returns a pointer to a clone of this functor.
00249      */
00250     virtual functor* clone() const;
00251 
00252     /**
00253      * returns used parameters
00254      */
00255     const parameters& getParameters() const;
00256 
00257     /**
00258      * return a mask with the local maxima of a channel
00259      */
00260     void normalize(channel& chnl) const;
00261 
00262 
00263   protected:
00264 
00265     /**
00266      * generate conspicuity map for intensity contrast
00267      * This method uses edge detection for the saliency.
00268      */
00269     void intensityConsp(const channel& intensity,
00270                         channel& iconsp) const;
00271 
00272     /**
00273      * generate color conspicuity map
00274      */
00275     void colorConsp(const channel& red,
00276                     const channel& green,
00277                     const channel& blue,
00278                     channel& cconsp) const;
00279 
00280     /**
00281      * generate orientation conspicuity map
00282      */
00283     void orientationConsp(const channel& intensity,
00284                           channel& oconsp) const;
00285 
00286     /**
00287      * generate a pyramid using square filters with the resolutions i specified
00288      * in the resolutions-list and the next ones (i and i+1)
00289      */
00290     void squarePyramid(const channel& src,
00291                        pyramid<channel>& pyram) const;
00292 
00293     /**
00294      * generate a pyramid using square filters with only the resolutions in
00295      * the list
00296      */
00297     void squarePyramid0(const channel& src,
00298                        pyramid<channel>& pyram) const;
00299     /**
00300      * generate a pyramid using square filters with only the resolutions
00301      * following the ones in the list.
00302      */
00303     void squarePyramid1(const channel& src,
00304                        pyramid<channel>& pyram) const;
00305 
00306     /**
00307      * list with the "most important" resolutions for the given image.
00308      */
00309     std::list<int> resolutions;
00310 
00311     /**
00312      * resolution with the highest kullback
00313      */
00314     int resWithHighestKullback;
00315 
00316 
00317   };
00318 }
00319 
00320 #endif

Generated on Sat Apr 10 15:25:29 2010 for LTI-Lib by Doxygen 1.6.1