latest version v1.9 - last update 10 Apr 2010 |
00001 /* 00002 * Copyright (C) 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 .......: ltiIsotropicNormalization.h 00027 * authors ....: Claudia Goenner 00028 * organization: LTI, RWTH Aachen 00029 * creation ...: 29.3.2004 00030 * revisions ..: $Id: ltiIsotropicNormalization.h,v 1.5 2006/02/08 11:19:20 ltilib Exp $ 00031 */ 00032 00033 #ifndef _LTI_ISOTROPIC_NORMALIZATION_H_ 00034 #define _LTI_ISOTROPIC_NORMALIZATION_H_ 00035 00036 #include "ltiPointSetNormalization.h" 00037 00038 namespace lti { 00039 00040 /** 00041 * A class for isotropic normalizations of point sets. The points 00042 * are translated so that their center of gravity lies in the 00043 * coordinate's system origin. Both axis are scaled to ensure 00044 * an average distance of the points to the origin, 00045 * e.g. 1 or sqrt(2). The same scale factor is applied to both axis. 00046 */ 00047 class isotropicNormalization : public pointSetNormalization { 00048 public: 00049 /** 00050 * The parameters for the class isotropicNormalization 00051 */ 00052 class parameters : public pointSetNormalization::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 * Read the parameters from 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 /** 00138 * The average distance of the points to the center of gravity of the 00139 * point cloud. The literature advises sqrt(2). Default: sqrt(2). 00140 */ 00141 float averageDistance; 00142 00143 }; 00144 00145 /** 00146 * Default constructor 00147 */ 00148 isotropicNormalization(); 00149 00150 /** 00151 * Construct a functor using the given parameters 00152 */ 00153 isotropicNormalization(const parameters& par); 00154 00155 /** 00156 * Copy constructor 00157 * @param other the object to be copied 00158 */ 00159 isotropicNormalization(const isotropicNormalization& other); 00160 00161 /** 00162 * Destructor 00163 */ 00164 virtual ~isotropicNormalization(); 00165 00166 /** 00167 * Returns the name of this type ("isotropicNormalization") 00168 */ 00169 virtual const char* getTypeName() const; 00170 00171 /** 00172 * Normalizes the supplied point vector. 00173 * operates on the given %parameter. 00174 * @param srcdest vector<fpoint> with the source data. The result 00175 * will be left here too. 00176 * @return true if apply successful or false otherwise. 00177 */ 00178 bool apply(vector<fpoint>& srcdest) const; 00179 00180 /** 00181 * Normalizes the supplied point vector as defined by 00182 * normedPt = scale * pt + shift. The parameters scale and shift 00183 * are computed automatically. 00184 * operates on the given %parameter. 00185 * @param srcdest vector<fpoint> with the source data. The result 00186 * will be left here too. 00187 * @param scale fpoint where the applied scale will be left 00188 * @param shift fpoint where the applied shift will be left 00189 * @return true if apply successful or false otherwise. 00190 */ 00191 bool apply(vector<fpoint>& srcdest, 00192 fpoint& scale, fpoint& shift) const; 00193 00194 /** 00195 * Normalizes the supplied point vector. 00196 * operates on the given %parameter. 00197 * @param srcdest vector<dpoint> with the source data. The result 00198 * will be left here too. 00199 * @return true if apply successful or false otherwise. 00200 */ 00201 bool apply(vector<dpoint>& srcdest) const; 00202 00203 /** 00204 * Normalizes the supplied point vector as defined by 00205 * normedPt = scale * pt + shift. The parameters scale and shift 00206 * are computed automatically. 00207 * operates on the given %parameter. 00208 * @param srcdest vector<dpoint> with the source data. The result 00209 * will be left here too. 00210 * @param scale dpoint where the applied scale will be left 00211 * @param shift dpoint where the applied shift will be left 00212 * @return true if apply successful or false otherwise. 00213 */ 00214 bool apply(vector<dpoint>& srcdest, 00215 dpoint& scale, dpoint& shift) const; 00216 00217 /** 00218 * Normalizes the supplied point vector. 00219 * operates on a copy of the given %parameters. 00220 * @param src vector<fpoint> with the source data. 00221 * @param dest vector<fpoint> where the result will be left. 00222 * @return true if apply successful or false otherwise. 00223 */ 00224 bool apply(const vector<fpoint>& src,vector<fpoint>& dest) const; 00225 00226 /** 00227 * Normalizes the supplied point vector as defined by 00228 * normedPt = scale * pt + shift. The parameters scale and shift 00229 * are computed automatically. 00230 * operates on a copy of the given %parameters. 00231 * @param src vector<fpoint> with the source data. 00232 * @param dest vector<fpoint> where the result will be left. 00233 * @param scale fpoint where the applied scale will be left 00234 * @param shift fpoint where the applied shift will be left 00235 * @return true if apply successful or false otherwise. 00236 */ 00237 bool apply(const vector<fpoint>& src,vector<fpoint>& dest, 00238 fpoint& scale, fpoint& shift) const; 00239 00240 /** 00241 * Normalizes the supplied point vector. 00242 * operates on a copy of the given %parameters. 00243 * @param src vector<dpoint> with the source data. 00244 * @param dest vector<dpoint> where the result will be left. 00245 * @return true if apply successful or false otherwise. 00246 */ 00247 bool apply(const vector<dpoint>& src,vector<dpoint>& dest) const; 00248 00249 /** 00250 * Normalizes the supplied point vector as defined by 00251 * normedPt = scale * pt + shift. The parameters scale and shift 00252 * are computed automatically. 00253 * operates on a copy of the given %parameters. 00254 * @param src vector<dpoint> with the source data. 00255 * @param dest vector<dpoint> where the result will be left. 00256 * @param scale dpoint where the applied scale will be left 00257 * @param shift dpoint where the applied shift will be left 00258 * @return true if apply successful or false otherwise. 00259 */ 00260 bool apply(const vector<dpoint>& src,vector<dpoint>& dest, 00261 dpoint& scale, dpoint& shift) const; 00262 00263 /** 00264 * Copy data of "other" functor. 00265 * @param other the functor to be copied 00266 * @return a reference to this functor object 00267 */ 00268 isotropicNormalization& copy(const isotropicNormalization& other); 00269 00270 /** 00271 * Alias for copy member 00272 * @param other the functor to be copied 00273 * @return a reference to this functor object 00274 */ 00275 isotropicNormalization& operator=(const isotropicNormalization& other); 00276 00277 /** 00278 * Returns a pointer to a clone of this functor. 00279 */ 00280 virtual functor* clone() const; 00281 00282 /** 00283 * Returns used parameters 00284 */ 00285 const parameters& getParameters() const; 00286 00287 }; 00288 } 00289 00290 #endif