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 .......: ltiFrankotChellapa.h 00027 * authors ....: Frederik Lange 00028 * organization: LTI, RWTH Aachen 00029 * creation ...: 4.4.2001 00030 * revisions ..: $Id: ltiFrankotChellapa.h,v 1.8 2006/02/08 11:09:16 ltilib Exp $ 00031 */ 00032 00033 #ifndef _LTI_FRANKOT_CHELLAPA_H_ 00034 #define _LTI_FRANKOT_CHELLAPA_H_ 00035 00036 #include "ltiModifier.h" 00037 00038 namespace lti { 00039 /** 00040 * The Francot-Chellapa argorithm extracts a depth image from an 00041 * intensity image. 00042 * 00043 * It uses the shading information contained in the gradient of the 00044 * intensity image, and uses the FFT to integrate this information, which 00045 * each the way it uses to gain the depth information. 00046 * 00047 * For a detail description of the algorithm see: 00048 * R. Klette, et. al. Computer Vision. Three-Dimensional Data from Images 00049 * pp. 109ff. 00050 */ 00051 class frankotChellapa : public modifier { 00052 public: 00053 /** 00054 * the parameters for the class frankotChellapa 00055 */ 00056 class parameters : public modifier::parameters { 00057 public: 00058 /** 00059 * default constructor 00060 */ 00061 parameters(); 00062 00063 /** 00064 * copy constructor 00065 * @param other the parameters object to be copied 00066 */ 00067 parameters(const parameters& other); 00068 00069 /** 00070 * destructor 00071 */ 00072 ~parameters(); 00073 00074 /** 00075 * returns name of this type 00076 */ 00077 const char* getTypeName() const; 00078 00079 /** 00080 * copy the contents of a parameters object 00081 * @param other the parameters object to be copied 00082 * @return a reference to this parameters object 00083 */ 00084 parameters& copy(const parameters& other); 00085 00086 /** 00087 * copy the contents of a parameters object 00088 * @param other the parameters object to be copied 00089 * @return a reference to this parameters object 00090 */ 00091 parameters& operator=(const parameters& other); 00092 00093 00094 /** 00095 * returns a pointer to a clone of the parameters 00096 */ 00097 virtual functor::parameters* clone() const; 00098 00099 /** 00100 * write the parameters in the given ioHandler 00101 * @param handler the ioHandler to be used 00102 * @param complete if true (the default) the enclosing begin/end will 00103 * be also written, otherwise only the data block will be written. 00104 * @return true if write was successful 00105 */ 00106 virtual bool write(ioHandler& handler,const bool complete=true) const; 00107 00108 /** 00109 * write the parameters in the given ioHandler 00110 * @param handler the ioHandler to be used 00111 * @param complete if true (the default) the enclosing begin/end will 00112 * be also written, otherwise only the data block will be written. 00113 * @return true if write was successful 00114 */ 00115 virtual bool read(ioHandler& handler,const bool complete=true); 00116 00117 # ifdef _LTI_MSC_6 00118 /** 00119 * this function is required by MSVC only, as a workaround for a 00120 * very awful bug, which exists since MSVC V.4.0, and still by 00121 * V.6.0 with all bugfixes (so called "service packs") remains 00122 * there... This method is also public due to another bug, so please 00123 * NEVER EVER call this method directly: use read() instead 00124 */ 00125 bool readMS(ioHandler& handler,const bool complete=true); 00126 00127 /** 00128 * this function is required by MSVC only, as a workaround for a 00129 * very awful bug, which exists since MSVC V.4.0, and still by 00130 * V.6.0 with all bugfixes (so called "service packs") remains 00131 * there... This method is also public due to another bug, so please 00132 * NEVER EVER call this method directly: use write() instead 00133 */ 00134 bool writeMS(ioHandler& handler,const bool complete=true) const; 00135 # endif 00136 00137 // ------------------------------------------------ 00138 // the parameters 00139 // ------------------------------------------------ 00140 00141 //TODO: comment the parameters of your functor 00142 // If you add more parameters manually, do not forget to do following: 00143 // 1. indicate in the default constructor the default values 00144 // 2. make sure that the copy member also copy your new parameters 00145 // 3. make sure that the read and write members also read and 00146 // write your parameters 00147 00148 00149 /** 00150 * scale gives the z-scaling. 00151 * It is actually divided by the maximum intensity of the input Channel 00152 * default is 0.4 00153 */ 00154 int scale; 00155 00156 /** 00157 * kernelSize gives the size of the kernel for gradient 00158 * filtering in X and Y default is 5 00159 */ 00160 int kernelSize; 00161 }; 00162 00163 /** 00164 * default constructor 00165 */ 00166 frankotChellapa(); 00167 00168 /** 00169 * copy constructor 00170 * @param other the object to be copied 00171 */ 00172 frankotChellapa(const frankotChellapa& other); 00173 00174 /** 00175 * destructor 00176 */ 00177 virtual ~frankotChellapa(); 00178 00179 /** 00180 * returns the name of this type ("frankotChellapa") 00181 */ 00182 virtual const char* getTypeName() const; 00183 00184 /** 00185 * operates on the given %parameter. 00186 * @param srcdest channel with the source data. The result 00187 * will be left here too. 00188 * @return true if successful, false otherwise. 00189 */ 00190 bool apply(channel& srcdest); 00191 00192 /** 00193 * operates on a copy of the given %parameters. 00194 * @param src channel with the source data. 00195 * @param dest channel where the result will be left. 00196 * @return true if successful, false otherwise. 00197 */ 00198 bool apply(const channel& src,channel& dest); 00199 00200 /** 00201 * copy data of "other" functor. 00202 * @param other the functor to be copied 00203 * @return a reference to this functor object 00204 */ 00205 frankotChellapa& copy(const frankotChellapa& other); 00206 00207 /** 00208 * returns a pointer to a clone of this functor. 00209 */ 00210 virtual functor* clone() const; 00211 00212 /** 00213 * returns used parameters 00214 */ 00215 const parameters& getParameters() const; 00216 00217 private: 00218 void createVGrad(const channel &src,channel &dest,int kernelSize); 00219 void createHGrad(const channel &src,channel &dest,int kernelSize); 00220 00221 }; 00222 } 00223 00224 #endif