latest version v1.9 - last update 10 Apr 2010 |
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 .......: ltiShapeFeatureExtractor.h 00027 * authors ....: Ruediger Weiler 00028 * organization: LTI, RWTH Aachen 00029 * creation ...: 7.6.2001 00030 * revisions ..: $Id: ltiShapeFeatureExtractor.h,v 1.8 2006/02/08 11:49:58 ltilib Exp $ 00031 */ 00032 00033 #ifndef _LTI_SHAPE_FEATURE_EXTRACTOR_H_ 00034 #define _LTI_SHAPE_FEATURE_EXTRACTOR_H_ 00035 00036 00037 #include "ltiPointList.h" 00038 #include "ltiVector.h" 00039 #include "ltiFunctor.h" 00040 00041 namespace lti { 00042 00043 /** 00044 * Base class for all clases which extract features from shapes 00045 * displayed with pointLists. 00046 */ 00047 class shapeFeatureExtractor : public functor { 00048 public: 00049 /** 00050 * the parameters for the class shapeFeatureExtractor 00051 */ 00052 class parameters : public functor::parameters { 00053 public: 00054 /** 00055 * default constructor 00056 */ 00057 parameters(); 00058 00059 /** 00060 * copy constructor 00061 * @param other the parameters object to be copied 00062 */ 00063 parameters(const parameters& other); 00064 00065 /** 00066 * destructor 00067 */ 00068 ~parameters(); 00069 00070 /** 00071 * returns name of this type 00072 */ 00073 const char* getTypeName() const; 00074 00075 /** 00076 * copy the contents of a parameters object 00077 * @param other the parameters object to be copied 00078 * @return a reference to this parameters object 00079 */ 00080 parameters& copy(const parameters& other); 00081 00082 /** 00083 * copy the contents of a parameters object 00084 * @param other the parameters object to be copied 00085 * @return a reference to this parameters object 00086 */ 00087 parameters& operator=(const parameters& other); 00088 00089 00090 /** 00091 * returns a pointer to a clone of the parameters 00092 */ 00093 virtual functor::parameters* clone() const; 00094 00095 /** 00096 * write the parameters in the given ioHandler 00097 * @param handler the ioHandler to be used 00098 * @param complete if true (the default) the enclosing begin/end will 00099 * be also written, otherwise only the data block will be written. 00100 * @return true if write was successful 00101 */ 00102 virtual bool write(ioHandler& handler,const bool complete=true) const; 00103 00104 /** 00105 * write the parameters in the given ioHandler 00106 * @param handler the ioHandler to be used 00107 * @param complete if true (the default) the enclosing begin/end will 00108 * be also written, otherwise only the data block will be written. 00109 * @return true if write was successful 00110 */ 00111 virtual bool read(ioHandler& handler,const bool complete=true); 00112 00113 # ifdef _LTI_MSC_6 00114 /** 00115 * this function is required by MSVC only, as a workaround for a 00116 * very awful bug, which exists since MSVC V.4.0, and still by 00117 * V.6.0 with all bugfixes (so called "service packs") remains 00118 * there... This method is also public due to another bug, so please 00119 * NEVER EVER call this method directly: use read() instead 00120 */ 00121 bool readMS(ioHandler& handler,const bool complete=true); 00122 00123 /** 00124 * this function is required by MSVC only, as a workaround for a 00125 * very awful bug, which exists since MSVC V.4.0, and still by 00126 * V.6.0 with all bugfixes (so called "service packs") remains 00127 * there... This method is also public due to another bug, so please 00128 * NEVER EVER call this method directly: use write() instead 00129 */ 00130 bool writeMS(ioHandler& handler,const bool complete=true) const; 00131 # endif 00132 00133 // ------------------------------------------------ 00134 // the parameters 00135 // ------------------------------------------------ 00136 00137 //TODO: comment the parameters of your functor 00138 // If you add more parameters manually, do not forget to do following: 00139 // 1. indicate in the default constructor the default values 00140 // 2. make sure that the copy member also copy your new parameters 00141 // 3. make sure that the read and write members also read and 00142 // write your parameters 00143 00144 00145 }; 00146 00147 /** 00148 * default constructor 00149 */ 00150 shapeFeatureExtractor(); 00151 00152 /** 00153 * copy constructor 00154 * @param other the object to be copied 00155 */ 00156 shapeFeatureExtractor(const shapeFeatureExtractor& other); 00157 00158 /** 00159 * destructor 00160 */ 00161 virtual ~shapeFeatureExtractor(); 00162 00163 /** 00164 * returns the name of this type ("shapeFeatureExtractor") 00165 */ 00166 virtual const char* getTypeName() const; 00167 00168 /** 00169 * operates on the given %parameters. 00170 * @param src pointList with the source data. 00171 * @param feature dvector where the features will be left. 00172 * @return true if apply successful or false otherwise. 00173 */ 00174 virtual bool apply(const pointList& src, dvector& feature) const; 00175 00176 /** 00177 * copy data of "other" functor. 00178 * @param other the functor to be copied 00179 * @return a reference to this functor object 00180 */ 00181 shapeFeatureExtractor& copy(const shapeFeatureExtractor& other); 00182 00183 /** 00184 * returns a pointer to a clone of this functor. 00185 */ 00186 virtual functor* clone() const; 00187 00188 /** 00189 * returns used parameters 00190 */ 00191 const parameters& getParameters() const; 00192 }; 00193 } 00194 00195 #endif