eLynx SDK
v3.3.0 C++ image processing API reference |
00001 //============================================================================ 00002 // BSpline.h Math.Component package 00003 //============================================================================ 00004 // Usage : linear algebra - Bicubic Spline 00005 //---------------------------------------------------------------------------- 00006 // Copyright (C) 2007 by eLynx project 00007 // 00008 // This library is free software; you can redistribute it and/or 00009 // modify it under the terms of the GNU Library General Public 00010 // License as published by the Free Software Foundation; either 00011 // version 2 of the License, or (at your option) any later version. 00012 // 00013 // This library is distributed in the hope that it will be useful, 00014 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 00016 // See the GNU Library General Public License for more details. 00017 //---------------------------------------------------------------------------- 00018 #ifndef __BSpline_h__ 00019 #define __BSpline_h__ 00020 00021 #include <boost/scoped_array.hpp> 00022 #include <elx/core/CoreTypes.h> 00023 #include <elx/math/ISpline.h> 00024 00025 namespace eLynx { 00026 namespace Math { 00027 00034 template <typename F> 00035 class BSpline1 : public ISpline1D<F,3> 00036 { 00037 public: 00038 typedef F type; 00039 00045 template <typename T> 00046 BSpline1(const int32* iX, uint32 iWidth, const T* iData); 00047 00048 // virtual from ISpline1D 00049 virtual bool IsUseful() const; 00050 virtual std::pair<int32,int32> GetRange() const; 00051 virtual F Evaluate(int32 iX) const; 00052 00053 private: 00055 BSpline1(const BSpline1&); 00056 BSpline1& operator=(const BSpline1&); 00057 00059 uint32 _Width; 00060 00062 boost::scoped_array<int32> _spPoints; 00064 boost::scoped_array<F> _spData; 00066 boost::scoped_array<F> _spDer; 00067 00069 boost::scoped_array<double> _spD; 00070 boost::scoped_array<double> _spDelta; 00071 boost::scoped_array<F> _spW; 00072 }; 00073 00076 typedef BSpline1<int32> BSpline1i; 00077 typedef BSpline1<int64> BSpline1l; 00078 typedef BSpline1<float> BSpline1f; 00079 typedef BSpline1<double> BSpline1d; 00081 00082 00090 template <typename F> 00091 class BSpline2 : public ISpline2D<F,3> 00092 { 00093 public: 00094 typedef F type; 00095 00102 template <typename T> 00103 BSpline2(const int32* iX, const int32* iY, uint32 iW, uint32 iH, const T* iData); 00104 00105 // virtual from ISpline2D 00106 virtual bool IsUseful() const; 00107 virtual std::pair<int32,int32> GetXRange() const; 00108 virtual std::pair<int32,int32> GetYRange() const; 00109 virtual F Evaluate(int32 iX, int32 iY) const; 00110 virtual void Evaluate(const int32 *iX, uint32 iSize, int32 iY, F* oValues) const; 00111 00112 private: 00114 BSpline2(const BSpline2&); 00115 BSpline2& operator=(const BSpline2&); 00116 00118 uint32 _Width; 00119 00121 uint32 _Height; 00122 00124 boost::scoped_array<int32> _spXPoints; 00125 boost::scoped_array<int32> _spYPoints; 00127 boost::scoped_array<F> _spData; 00129 boost::scoped_array<F> _spDer; 00130 00132 boost::scoped_array<double> _spD; 00133 boost::scoped_array<double> _spDelta; 00134 boost::scoped_array<F> _spW; 00135 }; 00136 00139 typedef BSpline2<int32> BSpline2i; 00140 typedef BSpline2<int64> BSpline2l; 00141 typedef BSpline2<float> BSpline2f; 00142 typedef BSpline2<double> BSpline2d; 00144 00145 00146 } // namespace Math 00147 } // namespace eLynx 00148 00149 #include "inl/BSpline.inl" 00150 00151 #endif // __BSpine_h__