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 .......: ltiQmfInverse.h 00027 * authors ....: Pablo Alvarado 00028 * organization: LTI, RWTH Aachen 00029 * creation ...: 23.1.2001 00030 * revisions ..: $Id: ltiQmfInverse.h,v 1.5 2006/02/08 11:42:30 ltilib Exp $ 00031 */ 00032 00033 #ifndef _LTI_QMF_INVERSE_H_ 00034 #define _LTI_QMF_INVERSE_H_ 00035 00036 #include "ltiFilter.h" 00037 #include "ltiQmf.h" 00038 #include "ltiUpsampling.h" 00039 00040 namespace lti { 00041 /** 00042 * This class allows the reconstruction of channels which were wavelet- 00043 * transformed by the functor lti::qmf. 00044 * 00045 * The low-pass kernel specified in the parameters will be used to calculate 00046 * the wavelet coefficients required in the inverse wavelet transform. 00047 * 00048 * @see lti::qmfInverse::parameters 00049 */ 00050 class qmfInverse : public filter { 00051 public: 00052 /** 00053 * the parameters for the class qmfInverse are the same than for the 00054 * qmf functor (see lti::qmf::parameters). This way it is really easy 00055 * to set the parameters for the transform and its inverse: 00056 * \code 00057 * lti::qmf theTransform; 00058 * lti::qmfInverse theInvTransform; 00059 * 00060 * lti::qmf::parameters qmfParam; 00061 * qmfParam.setKernel(haarKernel()); // use the haar kernel 00062 * qmfParam.levels = 3; // decompose in one low-pass band and 00063 * // three high-pass bands 00064 * theTransform.setParameters(qmfParam); 00065 * theInvTransform.setParameters(qmfParam); // the same parameters can be 00066 * // used! 00067 * \endcode 00068 */ 00069 typedef lti::qmf::parameters parameters; 00070 00071 /** 00072 * default constructor 00073 */ 00074 qmfInverse(); 00075 00076 /** 00077 * copy constructor 00078 * @param other the object to be copied 00079 */ 00080 qmfInverse(const qmfInverse& other); 00081 00082 /** 00083 * destructor 00084 */ 00085 virtual ~qmfInverse(); 00086 00087 /** 00088 * returns the name of this type ("qmfInverse") 00089 */ 00090 virtual const char* getTypeName() const; 00091 00092 /** 00093 * operates on the given %parameter. 00094 * @param srcdest channel with the source data. The result 00095 * will be left here too. 00096 * @result a reference to the <code>srcdest</code>. 00097 */ 00098 bool apply(channel& srcdest); 00099 00100 /** 00101 * operates on the given %parameter. 00102 * @param srcdest vector<float> with the source data. The result 00103 * will be left here too. 00104 * @result a reference to the <code>srcdest</code>. 00105 */ 00106 bool apply(vector<float>& srcdest); 00107 00108 /** 00109 * operates on a copy of the given %parameters. 00110 * @param src channel with the source data. 00111 * @param dest channel where the result will be left. 00112 * @result a reference to the <code>dest</code>. 00113 */ 00114 bool apply(const channel& src,channel& dest); 00115 00116 /** 00117 * operates on a copy of the given %parameters. 00118 * @param src vector<float> with the source data. 00119 * @param dest vector<float> where the result will be left. 00120 * @result a reference to the <code>dest</code>. 00121 */ 00122 bool apply(const vector<float>& src,vector<float>& dest); 00123 00124 /** 00125 * copy data of "other" functor. 00126 * @param other the functor to be copied 00127 * @return a reference to this functor object 00128 */ 00129 qmfInverse& copy(const qmfInverse& other); 00130 00131 /** 00132 * returns a pointer to a clone of this functor. 00133 */ 00134 virtual functor* clone() const; 00135 00136 /** 00137 * returns used parameters 00138 */ 00139 const parameters& getParameters() const; 00140 00141 protected: 00142 /** 00143 * transform just the two bands between the given indices. The 00144 * result will be left at the same place! 00145 * Do not forget to initialize the upsampling functors before calling 00146 * this member! 00147 */ 00148 void mergeTwo(vector<float>& src, 00149 const int& from, 00150 const int& to) const; 00151 00152 /** 00153 * transform just the two bands between the given indices for each 00154 * row. The result will be left at the same place! 00155 * Do not forget to initialize the upsampling functors before calling 00156 * this member! 00157 */ 00158 void mergeTwo(channel& src, 00159 const int& fromRow, 00160 const int& toRow, 00161 const int& fromCol, 00162 const int& toCol) const; 00163 00164 /** 00165 * transform just the two bands between the given indices for each 00166 * column. The result will be left at the same place! 00167 * Do not forget to initialize the upsampling functors before calling 00168 * this member! 00169 */ 00170 void mergeTwoCol(channel& src, 00171 const int& fromRow, 00172 const int& toRow, 00173 const int& fromCol, 00174 const int& toCol) const; 00175 00176 /** 00177 * upsampling functor for the low-frecuency band 00178 */ 00179 upsampling lowUpsampler; 00180 00181 /** 00182 * upsampling functor for the high-frecuency band 00183 */ 00184 upsampling highUpsampler; 00185 00186 /** 00187 * upsampling functor for the low-frecuency band of columns 00188 */ 00189 upsampling lowColUpsampler; 00190 00191 /** 00192 * upsampling functor for the high-frecuency band of columns 00193 */ 00194 upsampling highColUpsampler; 00195 00196 /** 00197 * initialize both upsampling functors, using the kernel filter specified 00198 * in the parameters. If onlyRows is false, also the upsamplers for 00199 * columns of channels will be initialized. 00200 */ 00201 void initializeUpsamplers(const bool onlyRows=true); 00202 }; 00203 } 00204 00205 #endif