00001
00024 #ifndef VIGRA_EXT_EMOR_H
00025 #define VIGRA_EXT_EMOR_H
00026
00027 #include <assert.h>
00028
00029 #include <vector>
00030
00031 #include <vigra/numerictraits.hxx>
00032 #include <vigra_ext/utils.h>
00033
00034
00035
00036 namespace vigra_ext{
00037
00038 namespace EMoR
00039 {
00040 extern IMPEX double f0[1024];
00041 extern IMPEX double h[25][1024];
00042
00043 template <class VECTOR>
00044 inline void createEMoRLUT(const std::vector<float> & params, VECTOR & lut)
00045 {
00046 typedef typename VECTOR::value_type VT;
00047
00048 VT s = (VT) vigra_ext::LUTTraits<VT>::max();
00049
00050
00051 size_t nDim = params.size();
00052 assert(nDim < 26);
00053 lut.resize(1024);
00054 for (int i=0; i<1024; ++i) {
00055 double t = vigra_ext::EMoR::f0[i];
00056 for (size_t j=0; j < nDim; j++) {
00057 t += params[j] * vigra_ext::EMoR::h[j][i];
00058 }
00059 lut[i] = vigra::NumericTraits<VT>::fromRealPromote(t*s);
00060 }
00061 }
00062 }
00063
00064 }
00065
00066 #endif // VIGRA_EXT_VIGNETTING_CORRECTION_H