latest version v1.9 - last update 10 Apr 2010 |
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 .......: ltiCornerDetector.h 00027 * authors ....: Pablo Alvarado 00028 * organization: LTI, RWTH Aachen 00029 * creation ...: 29.10.2002 00030 * revisions ..: $Id: ltiCornerDetector.h,v 1.7 2006/02/07 18:42:08 ltilib Exp $ 00031 */ 00032 00033 #ifndef _LTI_CORNER_DETECTOR_H_ 00034 #define _LTI_CORNER_DETECTOR_H_ 00035 00036 #include "ltiModifier.h" 00037 #include "ltiPointList.h" 00038 00039 namespace lti { 00040 /** 00041 * Parent class for all corner detectors. 00042 * 00043 * A corner detector finds "corner" pixels, where the definition of 00044 * corner depends on the algorithm used. 00045 * 00046 * The most algorithms compute a "cornerness" value, and then select 00047 * the local maxima. 00048 * 00049 * The interface specify two ways to return the corner points. The 00050 * first one generates an image with the same dimensions of the 00051 * original one, with the values parameters::noCornerValue and 00052 * parameters::cornerValue. (For the channel apply, these values are 00053 * scaled by 255). 00054 * 00055 */ 00056 class cornerDetector : public modifier { 00057 public: 00058 /** 00059 * the parameters for the class cornerDetector 00060 */ 00061 class parameters : public modifier::parameters { 00062 public: 00063 /** 00064 * default constructor 00065 */ 00066 parameters(); 00067 00068 /** 00069 * copy constructor 00070 * @param other the parameters object to be copied 00071 */ 00072 parameters(const parameters& other); 00073 00074 /** 00075 * destructor 00076 */ 00077 ~parameters(); 00078 00079 /** 00080 * returns name of this type 00081 */ 00082 const char* getTypeName() const; 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& copy(const parameters& other); 00090 00091 /** 00092 * copy the contents of a parameters object 00093 * @param other the parameters object to be copied 00094 * @return a reference to this parameters object 00095 */ 00096 parameters& operator=(const parameters& other); 00097 00098 00099 /** 00100 * returns a pointer to a clone of the parameters 00101 */ 00102 virtual functor::parameters* clone() 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 write(ioHandler& handler,const bool complete=true) const; 00112 00113 /** 00114 * read the parameters from the given ioHandler 00115 * @param handler the ioHandler to be used 00116 * @param complete if true (the default) the enclosing begin/end will 00117 * be also written, otherwise only the data block will be written. 00118 * @return true if write was successful 00119 */ 00120 virtual bool read(ioHandler& handler,const bool complete=true); 00121 00122 # ifdef _LTI_MSC_6 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 read() instead 00129 */ 00130 bool readMS(ioHandler& handler,const bool complete=true); 00131 00132 /** 00133 * this function is required by MSVC only, as a workaround for a 00134 * very awful bug, which exists since MSVC V.4.0, and still by 00135 * V.6.0 with all bugfixes (so called "service packs") remains 00136 * there... This method is also public due to another bug, so please 00137 * NEVER EVER call this method directly: use write() instead 00138 */ 00139 bool writeMS(ioHandler& handler,const bool complete=true) const; 00140 # endif 00141 00142 // ------------------------------------------------ 00143 // the parameters 00144 // ------------------------------------------------ 00145 00146 /** 00147 * Value used in the destination image to denote a corner. 00148 * The value must be between 0 and 255. For channels the used 00149 * value will be scaled by 255. 00150 * 00151 * Default value: 255 00152 */ 00153 ubyte cornerValue; 00154 00155 /** 00156 * Value used in the destination image to denote no-corner pixel. 00157 * The value must be between 0 and 255. For channels the used 00158 * value will be scaled by 255. 00159 * 00160 * Default value: 0 00161 */ 00162 ubyte noCornerValue; 00163 00164 }; 00165 00166 /** 00167 * default constructor 00168 */ 00169 cornerDetector(); 00170 00171 /** 00172 * copy constructor 00173 * @param other the object to be copied 00174 */ 00175 cornerDetector(const cornerDetector& other); 00176 00177 /** 00178 * destructor 00179 */ 00180 virtual ~cornerDetector(); 00181 00182 /** 00183 * returns the name of this type ("cornerDetector") 00184 */ 00185 virtual const char* getTypeName() const; 00186 00187 /** 00188 * operates on the given %parameter. 00189 * @param srcdest channel8 with the source data. The result 00190 * will be left here too. 00191 * @return true if apply successful or false otherwise. 00192 */ 00193 virtual bool apply(channel8& srcdest) const; 00194 00195 /** 00196 * operates on the given %parameter. 00197 * @param srcdest channel with the source data. The result 00198 * will be left here too. 00199 * @return true if apply successful or false otherwise. 00200 */ 00201 virtual bool apply(channel& srcdest) const; 00202 00203 /** 00204 * operates on a copy of the given %parameters. 00205 * @param src channel8 with the source data. 00206 * @param dest channel8 where the result will be left. 00207 * @return true if apply successful or false otherwise. 00208 */ 00209 virtual bool apply(const channel8& src,channel8& dest) const; 00210 00211 /** 00212 * operates on a copy of the given %parameters. 00213 * @param src channel with the source data. 00214 * @param dest channel where the result will be left. 00215 * @return true if apply successful or false otherwise. 00216 */ 00217 virtual bool apply(const channel& src,channel& dest) const; 00218 00219 /** 00220 * operates on a copy of the given %parameters. 00221 * @param src channel8 with the source data. 00222 * @param dest list of corners 00223 * @return true if apply successful or false otherwise. 00224 */ 00225 virtual bool apply(const channel8& src,pointList& dest) const = 0; 00226 00227 /** 00228 * operates on a copy of the given %parameters. 00229 * @param src channel with the source data. 00230 * @param dest list of corners 00231 * @return true if apply successful or false otherwise. 00232 */ 00233 virtual bool apply(const channel& src,pointList& dest) const = 0; 00234 00235 /** 00236 * copy data of "other" functor. 00237 * @param other the functor to be copied 00238 * @return a reference to this functor object 00239 */ 00240 cornerDetector& copy(const cornerDetector& other); 00241 00242 /** 00243 * alias for copy member 00244 * @param other the functor to be copied 00245 * @return a reference to this functor object 00246 */ 00247 cornerDetector& operator=(const cornerDetector& other); 00248 00249 /** 00250 * returns a pointer to a clone of this functor. 00251 */ 00252 virtual functor* clone() const = 0; 00253 00254 /** 00255 * returns used parameters 00256 */ 00257 const parameters& getParameters() const; 00258 00259 }; 00260 } 00261 00262 #endif