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

ltiBorderExtrema.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 .......: ltiBorderExtrema.h
00027  * authors ....: Ruediger Weiler
00028  * organization: LTI, RWTH Aachen
00029  * creation ...: 11.6.2001
00030  * revisions ..: $Id: ltiBorderExtrema.h,v 1.8 2006/02/07 18:32:12 ltilib Exp $
00031  */
00032 
00033 #ifndef _LTI_BORDER_EXTREMA_H_
00034 #define _LTI_BORDER_EXTREMA_H_
00035 
00036 #include "ltiModifier.h"
00037 
00038 namespace lti {
00039   class borderPoints; //declaration in ltiContour.h
00040   class polygonPoints; //declaration in ltiPolygonPoints.h
00041 
00042   /**
00043    *  This functor extracts minimum and maximum positions along a border
00044    *  in terms of distance to a given center point.
00045    *  The extrema are saved in a polygonPoint either separate or in
00046    *  one List alternately as min, max, min, ... always starting with
00047    *  a minimum.
00048    */
00049   class borderExtrema : public modifier {
00050   public:
00051     /**
00052      * the parameters for the class borderExtrema
00053      */
00054     class parameters : public modifier::parameters {
00055     public:
00056       /**
00057        * default constructor
00058        */
00059       parameters();
00060 
00061       /**
00062        * copy constructor
00063        * @param other the parameters object to be copied
00064        */
00065       parameters(const parameters& other);
00066 
00067       /**
00068        * destructor
00069        */
00070       ~parameters();
00071 
00072       /**
00073        * returns name of this type
00074        */
00075       const char* getTypeName() const;
00076 
00077       /**
00078        * copy the contents of a parameters object
00079        * @param other the parameters object to be copied
00080        * @return a reference to this parameters object
00081        */
00082       parameters& copy(const parameters& other);
00083 
00084       /**
00085        * copy the contents of a parameters object
00086        * @param other the parameters object to be copied
00087        * @return a reference to this parameters object
00088        */
00089       parameters& operator=(const parameters& other);
00090 
00091 
00092       /**
00093        * returns a pointer to a clone of the parameters
00094        */
00095       virtual functor::parameters* clone() const;
00096 
00097       /**
00098        * write the parameters in the given ioHandler
00099        * @param handler the ioHandler to be used
00100        * @param complete if true (the default) the enclosing begin/end will
00101        *        be also written, otherwise only the data block will be written.
00102        * @return true if write was successful
00103        */
00104       virtual bool write(ioHandler& handler,const bool complete=true) 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 read(ioHandler& handler,const bool complete=true);
00114 
00115 #     ifdef _LTI_MSC_6
00116       /**
00117        * this function is required by MSVC only, as a workaround for a
00118        * very awful bug, which exists since MSVC V.4.0, and still by
00119        * V.6.0 with all bugfixes (so called "service packs") remains
00120        * there...  This method is also public due to another bug, so please
00121        * NEVER EVER call this method directly: use read() instead
00122        */
00123       bool readMS(ioHandler& handler,const bool complete=true);
00124 
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 write() instead
00131        */
00132       bool writeMS(ioHandler& handler,const bool complete=true) const;
00133 #     endif
00134 
00135       // ------------------------------------------------
00136       // the parameters
00137       // ------------------------------------------------
00138 
00139       // If you add more parameters manually, do not forget to do following:
00140       // 1. indicate in the default constructor the default values
00141       // 2. make sure that the copy member also copy your new parameters
00142       // 3. make sure that the read and write members also read and
00143       //    write your parameters
00144 
00145 
00146       /**
00147        * The minimum number of rising/falling edges, before an extremum can
00148        * be detected. Corresponds to ignoring minor changes in border.
00149        * At the same time this is the minimum number of pixels along
00150        * the border between two extrema.
00151        * Default is 5.
00152        */
00153       int minTolerance;
00154 
00155       /**
00156        * Distances are calculated between borderPoints and "center".
00157        * The default value is (0.0, 0.0).
00158        */
00159       tpoint<double> center;
00160 
00161     };
00162 
00163     /**
00164      * default constructor
00165      */
00166     borderExtrema();
00167 
00168     /**
00169      * copy constructor
00170      * @param other the object to be copied
00171      */
00172     borderExtrema(const borderExtrema& other);
00173 
00174     /**
00175      * destructor
00176      */
00177     virtual ~borderExtrema();
00178 
00179     /**
00180      * returns the name of this type ("borderExtrema")
00181      */
00182     virtual const char* getTypeName() const;
00183 
00184     /**
00185      * operates on the given %parameter.
00186      * @param src borderPoints with the source border
00187      * @param min the polygonPoints who take the minima
00188      * @param max the polygonPoints who take the maxima
00189      * @return true if apply successful or false otherwise
00190      */
00191     bool apply(const borderPoints& src, polygonPoints& min, polygonPoints& max) const;
00192 
00193     /**
00194      * operates on the given %parameter.
00195      * @param src borderPoints with the source border
00196      * @param minMax the polygonPoints who take the extrema in order
00197      *                starting with a minima
00198      * @return true if apply successful or false otherwise.
00199      */
00200     bool apply(const borderPoints& src, polygonPoints& minMax) const;
00201 
00202 
00203     /**
00204      * copy data of "other" functor.
00205      * @param other the functor to be copied
00206      * @return a reference to this functor object
00207      */
00208     borderExtrema& copy(const borderExtrema& other);
00209 
00210     /**
00211      * returns a pointer to a clone of this functor.
00212      */
00213     virtual functor* clone() const;
00214 
00215     /**
00216      * returns used parameters
00217      */
00218     const parameters& getParameters() const;
00219 
00220     /**
00221      * sets the functor's parameters.
00222      */
00223     virtual bool updateParameters();
00224   };
00225 }
00226 
00227 #endif

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