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

ltiBorderSignature.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 .......: ltiborderSignature.h
00027  * authors ....: Ruediger Weiler
00028  * organization: LTI, RWTH Aachen
00029  * creation ...: 7.6.2001
00030  * revisions ..: $Id: ltiBorderSignature.h,v 1.8 2006/02/07 18:32:30 ltilib Exp $
00031  */
00032 
00033 #ifndef _LTI_BORDER_SIGNATURE_H_
00034 #define _LTI_BORDER_SIGNATURE_H_
00035 
00036 // include files which are needed in this header!!
00037 #include "ltiShapeFeatureExtractor.h"
00038 #include "ltiTypes.h"
00039 #include "ltiPointList.h"
00040 
00041 // include to parent class:
00042 #include "ltiFeatureExtractor.h"
00043 
00044 namespace lti {
00045   /**
00046    *  This functor extracts a functional border description from a borderPoint list.
00047    *  Therefore it divides the 2D-space into radial segments of equal size, originating
00048    *  from the given "center". Then it evaluates some function for the borderPoints, that
00049    *  lie within each segment. The result is stored in a lti::dvector.
00050    *
00051    *  The starting segments angle can be specified by the parameter "orientation".
00052    *  There are two methods of operation: "area" and "distance".
00053    *  The "area" method calculates the area proportion within each segment, normalized with
00054    *  the total area. The "distance" method calulates either the minimum, maximum or the
00055    *  average distance to the center point within a segment. This is specified by the
00056    *  "distanceType" parameter.
00057    */
00058   class borderSignature : public shapeFeatureExtractor {
00059   public:
00060     /**
00061      * the parameters for the class borderSignature
00062      */
00063     class parameters : public featureExtractor::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       // If you add more parameters manually, do not forget to do following:
00149       // 1. indicate in the default constructor the default values
00150       // 2. make sure that the copy member also copy your new parameters
00151       // 3. make sure that the read and write members also read and
00152       //    write your parameters
00153 
00154 
00155       /**  method type.
00156        *   This are the two modes of operation
00157        */
00158       enum eMethod {
00159         distance, /**< the distance to the border within each segment */
00160         area      /**< the area inside the border region within each segment */
00161       };
00162 
00163       /**  distance type.
00164        *   This are the sub-modes for the "distance" method
00165        */
00166       enum eDistanceType {
00167         min,      /**< search the minimum distance within each segment */
00168         max,      /**< search the maximum distance */
00169         average   /**< calculate the average distance */
00170       };
00171       /**
00172        * The origin of the segments, can be e.g. the center of gravity of a 2D-shape
00173        * the borderpoints (see lti::geometricFeatures).
00174        * The default value is (0.0 , 0.0).
00175        */
00176       tpoint<double> center;
00177 
00178       /**
00179        * The number of segments that the 2D-space is divided into.
00180        * Note: If you want to use FFT later set the value to pow(2,x).
00181        * The default value is 32.
00182        */
00183       int numberOfSegments;
00184 
00185       /**
00186        * This parameter specifies the orientation of the first segment.
00187        * The segments are ordered clockwise cyclic around "center".
00188        * An angle in radient between -2Pi and 2Pi is required.
00189        * The default value is 0.0 (Horizontal orientation).
00190        */
00191       double orientation;
00192 
00193       /**
00194        * The mode of operation (see eMethod).
00195        */
00196       eMethod method;
00197 
00198       /**
00199        * This specifies the sub-method of the "distance" method (see eDistanceType).
00200        */
00201       eDistanceType distanceType;
00202 
00203     };
00204 
00205     /**
00206      * default constructor
00207      */
00208     borderSignature();
00209 
00210     /**
00211      * copy constructor
00212      * @param other the object to be copied
00213      */
00214     borderSignature(const borderSignature& other);
00215 
00216     /**
00217      * destructor
00218      */
00219     virtual ~borderSignature();
00220 
00221     /**
00222      * returns the name of this type ("borderSignature")
00223      */
00224     virtual const char* getTypeName() const;
00225 
00226 
00227 
00228     /**
00229      * operates on a copy of the given %parameters.
00230      * @param src pointList with the source data.
00231      * @param segmentation dvector where the signature will be left.
00232      * @return true if apply successful or false otherwise.
00233      */
00234     bool apply(const pointList& src, dvector& segmentation) const;
00235 
00236 
00237     /**
00238      * copy data of "other" functor.
00239      * @param other the functor to be copied
00240      * @return a reference to this functor object
00241      */
00242     borderSignature& copy(const borderSignature& other);
00243 
00244     /**
00245      * returns a pointer to a clone of this functor.
00246      */
00247     virtual functor* clone() const;
00248 
00249     /**
00250      * returns used parameters
00251      */
00252     const parameters& getParameters() const;
00253 
00254     /**
00255      * sets the functor's parameters.
00256      */
00257     virtual bool updateParameters();
00258 
00259   };
00260 }
00261 
00262 #endif

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