support.h

Go to the documentation of this file.
00001 
00021 #ifndef SUPPORT_H_
00022 #define SUPPORT_H_
00023 
00024 #include "deghosting.h"
00025 
00026 #include <vigra/functorexpression.hxx>
00027 // used in hugin_hdrmerge
00028 // FIXME: move it to the hugin_hdrmerge
00029 #include <vigra/combineimages.hxx>
00030 
00031 namespace deghosting {
00032 
00035 template <class PixelType>
00036 class LogarithmFunctor {
00037     public:
00038         explicit LogarithmFunctor(PixelType off=0) : offset(off)  {}
00039         
00040         PixelType operator()(PixelType const& v) const {
00041             return std::log(v + offset);
00042         }
00043     protected:
00044         PixelType offset;
00045 };
00046 
00050 template <class ComponentType>
00051 class LogarithmFunctor<vigra::RGBValue<ComponentType> > {
00052     public:
00053         explicit LogarithmFunctor(ComponentType off=0) : offset(off) {}
00054         
00055         vigra::RGBValue<ComponentType> operator()(vigra::RGBValue<ComponentType> const& v) const {
00056             vigra::RGBValue<ComponentType> retVal;
00057             retVal[0] = log(v[0] + offset);
00058             retVal[1] = log(v[1] + offset);
00059             retVal[2] = log(v[2] + offset);
00060             //cout << retVal[0] << "," << retVal[1] << "," << retVal[2] << std::endl;
00061             return retVal;
00062         }
00063     protected:
00064         ComponentType offset;
00065 };
00066 
00070 template <class PixelType>
00071 class HatFunctor {
00072     public:
00073         HatFunctor() {}
00074         
00075         PixelType operator()(PixelType v) const {
00076             PixelType t = (v/127.5 -1);
00077             t *= t; // ^2
00078             t *= t; // ^4
00079             t *= t; // ^8
00080             t *= t; // ^16
00081             return 1.0 - t; 
00082         }
00083 };
00084 
00089 template <class ComponentType>
00090 class HatFunctor<vigra::RGBValue<ComponentType> > {
00091     public:
00092         HatFunctor() {}
00093         
00094         ComponentType operator()(vigra::RGBValue<ComponentType> v) const {
00095             ComponentType t = (v.luminance()/127.5 -1);
00096             t *= t; // ^2
00097             t *= t; // ^4
00098             t *= t; // ^8
00099             t *= t; // ^16
00100             return 1.0 - t; 
00101         }
00102 };
00103 
00106 template <class PixelType>
00107 class NormalizeFunctor {
00108     public:
00109         explicit NormalizeFunctor(PixelType f) : factor(f) {}
00110         NormalizeFunctor(PixelType oldMaxValue, PixelType newMaxValue) : factor(newMaxValue/oldMaxValue) {}
00111         
00112         PixelType operator()(PixelType const &v) const {
00113             return v*factor;
00114         }
00115     protected:
00116         PixelType factor;
00117 };
00118 
00122 template <class ComponentType>
00123 class NormalizeFunctor<vigra::RGBValue<ComponentType> > {
00124     public:
00125         NormalizeFunctor(vigra::RGBValue<ComponentType> oldMaxValue, vigra::RGBValue<ComponentType> newMaxValue) {
00126             // TODO
00127         }
00128         
00129         vigra::RGBValue<ComponentType> operator()(vigra::RGBValue<ComponentType> const &v) {
00130             // TODO
00131         }
00132     protected:
00133         vigra::RGBValue<ComponentType> foo;
00134 };
00135 
00136 }  // namespace deghosting
00137 
00138 #endif /* SUPPORT_H_ */

Generated on 26 Sep 2016 for Hugintrunk by  doxygen 1.4.7