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

ltiEdgeDetector.h

00001 /*
00002  * Copyright (C) 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-Lib: Image Processing and Computer Vision Library
00026  * file .......: ltiEdgeDetector.h
00027  * authors ....: Pablo Alvarado
00028  * organization: LTI, RWTH Aachen
00029  * creation ...: 30.10.2002
00030  * revisions ..: $Id: ltiEdgeDetector.h,v 1.8 2006/02/08 11:02:26 ltilib Exp $
00031  */
00032 
00033 #ifndef _LTI_EDGE_DETECTOR_H_
00034 #define _LTI_EDGE_DETECTOR_H_
00035 
00036 #include "ltiModifier.h"
00037 
00038 namespace lti {
00039   /**
00040    * Parent abstract class for all edge detectors.
00041    *
00042    * An edge detector finds the edges in an gray-valued image.  The
00043    * definition of "edge" is usually related to an abrupt change in
00044    * the intensity value of pixels.
00045    *
00046    * The result will be usually a channel8 containing only the two
00047    * values specified in the parameter to denote edge and no-edge.
00048    */
00049   class edgeDetector : public modifier {
00050   public:
00051     /**
00052      * the parameters for the class edgeDetector
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        * read the parameters from 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       /**
00140        * Value used to denote a no-edge pixel.
00141        *
00142        * The value must be between 0 and 255.  For channels the used
00143        * value will be scaled by 255.
00144        *
00145        * Default value: 0
00146        */
00147       ubyte noEdgeValue;
00148 
00149       /**
00150        * Value used to denote an edge pixel
00151        *
00152        * The value must be between 0 and 255.  For channels the used
00153        * value will be scaled by 255.
00154        *
00155        * Default value: 255
00156        */
00157       ubyte edgeValue;
00158 
00159     };
00160 
00161     /**
00162      * default constructor
00163      */
00164     edgeDetector();
00165 
00166     /**
00167      * copy constructor
00168      * @param other the object to be copied
00169      */
00170     edgeDetector(const edgeDetector& other);
00171 
00172     /**
00173      * destructor
00174      */
00175     virtual ~edgeDetector();
00176 
00177     /**
00178      * returns the name of this type ("edgeDetector")
00179      */
00180     virtual const char* getTypeName() const;
00181 
00182     /**
00183      * operates on the given %parameter.
00184      * @param srcdest channel8 with the source data.  The result
00185      *                 will be left here too.
00186      * @return true if apply successful or false otherwise.
00187      */
00188     virtual bool apply(channel8& srcdest) const;
00189 
00190     /**
00191      * operates on the given %parameter.
00192      * @param srcdest channel with the source data.  The result
00193      *                 will be left here too.
00194      * @return true if apply successful or false otherwise.
00195      */
00196     virtual bool apply(channel& srcdest) const;
00197 
00198     /**
00199      * operates on a copy of the given %parameters.
00200      * @param src channel8 with the source data.
00201      * @param dest channel8 where the result will be left.
00202      * @return true if apply successful or false otherwise.
00203      */
00204     virtual bool apply(const channel8& src,channel8& dest) const;
00205 
00206     /**
00207      * operates on a copy of the given %parameters.
00208      * @param src channel with the source data.
00209      * @param dest channel where the result will be left.
00210      * @return true if apply successful or false otherwise.
00211      */
00212     virtual bool apply(const channel& src,channel& dest) const;
00213 
00214     /**
00215      * operates on a copy of the given %parameters.
00216      * @param src channel with the source data.
00217      * @param dest channel8 where the result will be left.
00218      * @return true if apply successful or false otherwise.
00219      */
00220     virtual bool apply(const channel& src,channel8& dest) const;
00221 
00222     /**
00223      * Compute the edges for the red, green and blue components of the image
00224      * and leave the result in each channel of image.
00225      * @param srcdest image with the source data.  The result
00226      *                will be left here too.
00227      * @return true if apply successful or false otherwise.
00228      */
00229     virtual bool apply(image& srcdest) const;
00230 
00231     /**
00232      * Compute the edges for the red, green and blue components of the image
00233      * and leave the result in each channel of the destination image.
00234      * @param src image with the source data.
00235      * @param dest image where the result will be left.
00236      * @return true if apply successful or false otherwise.
00237      */
00238     virtual bool apply(const image& src,image& dest) const;
00239 
00240     /**
00241      * Compute the edges for the red, green and blue components of the image
00242      * and leave the sum of the results in the given channel.  Note that
00243      * if you give as parameters::edgeValue or parameters::noEdgeValue values
00244      * greater than 255/3, you can have some overflow effects on the resulting
00245      * channel.
00246      *
00247      * @param src image with the source data.
00248      * @param dest channel8 where the result will be left.
00249      * @return true if apply successful or false otherwise.
00250      */
00251     virtual bool apply(const image& src,channel8& dest) const;
00252 
00253     /**
00254      * copy data of "other" functor.
00255      * @param other the functor to be copied
00256      * @return a reference to this functor object
00257      */
00258     edgeDetector& copy(const edgeDetector& other);
00259 
00260     /**
00261      * alias for copy member
00262      * @param other the functor to be copied
00263      * @return a reference to this functor object
00264      */
00265     edgeDetector& operator=(const edgeDetector& other);
00266 
00267     /**
00268      * returns a pointer to a clone of this functor.
00269      */
00270     virtual functor* clone() const = 0;
00271 
00272     /**
00273      * returns used parameters
00274      */
00275     const parameters& getParameters() const;
00276   };
00277 }
00278 
00279 #endif

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