latest version v1.9 - last update 10 Apr 2010 |
00001 /* 00002 * Copyright (C) 2000, 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 .......: ltiPolarToCartesian.h 00027 * authors ....: Bernd Mussmann 00028 * organization: LTI, RWTH Aachen 00029 * creation ...: 4.9.2000 00030 * revisions ..: $Id: ltiPolarToCartesian.h,v 1.8 2006/02/08 11:38:46 ltilib Exp $ 00031 */ 00032 00033 #ifndef _LTI_POLAR_TO_CARTESIAN_H_ 00034 #define _LTI_POLAR_TO_CARTESIAN_H_ 00035 00036 //include files which are needed 00037 00038 #include "ltiMatrix.h" 00039 #include "ltiVector.h" 00040 // include to parent class: 00041 #include "ltiTransform.h" 00042 00043 namespace lti { 00044 /** 00045 * Computes the elements of the cartesian coordinate system (real,imaginary) based on 00046 * the parameters of the polar coordinate system (absolute value, phase). 00047 */ 00048 template<class T> 00049 class polarToCartesian : public transform { 00050 public: 00051 /** 00052 * the parameters for the class polarToCartesian 00053 */ 00054 class parameters : public transform::parameters { 00055 public: 00056 /** 00057 * default constructor 00058 */ 00059 parameters() : transform::parameters() {}; 00060 00061 /** 00062 * copy constructor 00063 * @param other the parameters object to be copied 00064 */ 00065 parameters(const parameters& other) 00066 : transform::parameters() { 00067 copy(other); 00068 }; 00069 00070 /** 00071 * destructor 00072 */ 00073 ~parameters() {}; 00074 00075 /** 00076 * returns name of this type 00077 */ 00078 const char* getTypeName() const { 00079 return "polarToCartesian::parameters"; 00080 }; 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& copy(const parameters& other) { 00088 # ifndef _LTI_MSC_6 00089 // MS Visual C++ 6 is not able to compile this... 00090 transform::parameters::copy(other); 00091 # else 00092 // ...so we have to use this workaround. 00093 // Conditional on that, copy may not be virtual. 00094 transform::parameters& (transform::parameters::* p_copy) 00095 (const transform::parameters&) = 00096 transform::parameters::copy; 00097 (this->*p_copy)(other); 00098 # endif 00099 00100 return *this; 00101 }; 00102 00103 /** 00104 * returns a pointer to a clone of the parameters 00105 */ 00106 virtual functor::parameters* clone() const { 00107 return new parameters(*this); 00108 }; 00109 }; 00110 00111 /** 00112 * default constructor 00113 */ 00114 polarToCartesian(); 00115 00116 /** 00117 * copy constructor 00118 * @param other the object to be copied 00119 */ 00120 polarToCartesian(const polarToCartesian& other); 00121 00122 /** 00123 * destructor 00124 */ 00125 virtual ~polarToCartesian(); 00126 00127 /** 00128 * returns the name of this type ("polarToCartesian") 00129 */ 00130 virtual const char* getTypeName() const; 00131 00132 /** 00133 * operates on the given parameter. 00134 * If the input matrices have different size, the result will be empty 00135 * @param abs_r matrix<T> the absolute value source data. 00136 * @param ph_i matrix<T> the phase source data. 00137 * @result references to abs_r (real) and 00138 * ph_i (imaginary). 00139 */ 00140 bool apply(matrix<T>& abs_r,matrix<T>& ph_i) const; 00141 00142 /** 00143 * operates on a copy of the given parameters. 00144 * If the input matrices have different size, the result will be empty 00145 * @param absvalue matrix<T> the absolute value source data. 00146 * @param phase matrix<T> the phase source data. 00147 * @param real reference to the target matrix which will receive the real part of the result. 00148 * @param imaginary reference to the target matrix which will receive the imaginary part of the result. 00149 */ 00150 bool apply(const matrix<T>& absvalue, 00151 const matrix<T>& phase, 00152 matrix<T>& real, 00153 matrix<T>& imaginary) const; 00154 00155 /** 00156 * operates on a copy of the given parameters. 00157 * @param src tpointList<T>& with the polar data the absolute in x and the angle in y. 00158 * @param dest this pointList gets the cartesian data 00159 * @param origin the origin of the coordiante system. 00160 * the angles and the absolute values are relative to this point. Default is (0,0). 00161 */ 00162 bool apply(const tpointList<double>& src, 00163 tpointList<T> &dest, 00164 const tpoint<double> origin=tpoint<double>(0.0,0.0) ) const; 00165 00166 /** 00167 * copy data of "other" functor. 00168 * @param other the functor to be copied 00169 * @return a reference to this functor object 00170 */ 00171 polarToCartesian& copy(const polarToCartesian& other); 00172 00173 /** 00174 * returns a pointer to a clone of this functor. 00175 */ 00176 virtual functor* clone() const; 00177 00178 /** 00179 * returns used parameters 00180 */ 00181 const parameters& getParameters() const; 00182 }; 00183 } 00184 00185 #include "ltiPolarToCartesian_template.h" 00186 00187 #endif