emor.h

Go to the documentation of this file.
00001 // -*- c-basic-offset: 4 -*-
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 //#define DEBUG_WRITE_FILES
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 // lookup tables
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 } // namespace
00065 
00066 #endif // VIGRA_EXT_VIGNETTING_CORRECTION_H

Generated on Tue Sep 2 01:25:42 2014 for Hugintrunk by  doxygen 1.3.9.1