eLynx SDK
v3.3.0 C++ image processing API reference |
00001 //============================================================================ 00002 // ResampleHelper.h Math.Component package 00003 //============================================================================ 00004 // Usage : define resample helper using filters 00005 //---------------------------------------------------------------------------- 00006 // Copyright (C) 2006 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 __ResampleHelper_h__ 00019 #define __ResampleHelper_h__ 00020 00021 #include "ResampleFilterImpls.h" 00022 #include <boost/scoped_array.hpp> 00023 00024 namespace eLynx { 00025 namespace Math { 00026 00027 class ExportedByMath ResampleHelper 00028 { 00029 public: 00030 00035 ResampleHelper(uint32 iOldSize, uint32 iNewSize, EResampleFilter iFilter); 00036 00040 uint32 GetContributorCount(uint32 iNewIndex) const; 00041 00046 uint32 GetOldIndex(uint32 iNewIndex, uint32 iContributor) const; 00047 00052 double GetWeight(uint32 iNewIndex, uint32 iContributor) const; 00053 00054 private: 00055 struct SampleWeight 00056 { 00057 SampleWeight() : _sample(0), _weight(0.0) {} 00058 int32 _sample; 00059 double _weight; 00060 }; 00061 00062 struct Contributor 00063 { 00064 int32 _n; 00065 SampleWeight * _plSampleList; 00066 double _weightSum; 00067 Contributor() : _plSampleList(0) {} 00068 ~Contributor() { delete [] _plSampleList; } 00069 }; 00070 00071 uint32 _newSize; 00072 boost::scoped_array<Contributor> _spContributors; 00073 }; 00074 00075 } // namespace Image 00076 } // namespace eLynx 00077 00078 #endif // __ResampleHelper_h__