eLynx SDK
v3.0.1 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 00031 ResampleHelper(uint32 iOldSize, uint32 iNewSize, EResampleFilter iFilter); 00032 00033 // Get the number of contributor for an index. 00034 // @param iNewIndex in range [0, newSize[ 00035 // @return the number of contributor. 00036 uint32 GetContributorCount(uint32 iNewIndex) const; 00037 00038 uint32 GetOldIndex(uint32 iNewIndex, uint32 iContributor) const; 00039 double GetWeight(uint32 iNewIndex, uint32 iContributor) const; 00040 00041 private: 00042 struct SampleWeight 00043 { 00044 SampleWeight() : _sample(0), _weight(0.0) {} 00045 int32 _sample; 00046 double _weight; 00047 }; 00048 00049 struct Contributor 00050 { 00051 int32 _n; 00052 SampleWeight * _plSampleList; 00053 double _weightSum; 00054 Contributor() : _plSampleList(0) {} 00055 ~Contributor() { delete [] _plSampleList; } 00056 }; 00057 00058 uint32 _newSize; 00059 boost::scoped_array<Contributor> _spContributors; 00060 }; 00061 00062 } // namespace Image 00063 } // namespace eLynx 00064 00065 #endif // __ResampleHelper_h__