Hugin trunk 0.1
Loading...
Searching...
No Matches
support.h
Go to the documentation of this file.
1
21#ifndef SUPPORT_H_
22#define SUPPORT_H_
23
24#include "deghosting.h"
25
26#include <vigra/functorexpression.hxx>
27// used in hugin_hdrmerge
28// FIXME: move it to the hugin_hdrmerge
29#include <vigra/combineimages.hxx>
30
31namespace deghosting {
32
35template <class PixelType>
37 public:
38 explicit LogarithmFunctor(PixelType off=0) : offset(off) {}
39
40 PixelType operator()(PixelType const& v) const {
41 return std::log(v + offset);
42 }
43 protected:
44 PixelType offset;
45};
46
50template <class ComponentType>
51class LogarithmFunctor<vigra::RGBValue<ComponentType> > {
52 public:
54
55 vigra::RGBValue<ComponentType> operator()(vigra::RGBValue<ComponentType> const& v) const {
56 vigra::RGBValue<ComponentType> retVal;
57 retVal[0] = log(v[0] + offset);
58 retVal[1] = log(v[1] + offset);
59 retVal[2] = log(v[2] + offset);
60 //cout << retVal[0] << "," << retVal[1] << "," << retVal[2] << std::endl;
61 return retVal;
62 }
63 protected:
65};
66
70template <class PixelType>
72 public:
74
75 PixelType operator()(PixelType v) const {
76 PixelType t = (v/127.5 -1);
77 t *= t; // ^2
78 t *= t; // ^4
79 t *= t; // ^8
80 t *= t; // ^16
81 return 1.0 - t;
82 }
83};
84
89template <class ComponentType>
90class HatFunctor<vigra::RGBValue<ComponentType> > {
91 public:
93
94 ComponentType operator()(vigra::RGBValue<ComponentType> v) const {
95 ComponentType t = (v.luminance()/127.5 -1);
96 t *= t; // ^2
97 t *= t; // ^4
98 t *= t; // ^8
99 t *= t; // ^16
100 return 1.0 - t;
101 }
102};
103
106template <class PixelType>
108 public:
109 explicit NormalizeFunctor(PixelType f) : factor(f) {}
111
112 PixelType operator()(PixelType const &v) const {
113 return v*factor;
114 }
115 protected:
116 PixelType factor;
117};
118
122template <class ComponentType>
123class NormalizeFunctor<vigra::RGBValue<ComponentType> > {
124 public:
125 NormalizeFunctor(vigra::RGBValue<ComponentType> oldMaxValue, vigra::RGBValue<ComponentType> newMaxValue) {
126 // TODO
127 }
128
129 vigra::RGBValue<ComponentType> operator()(vigra::RGBValue<ComponentType> const &v) {
130 // TODO
131 }
132 protected:
133 vigra::RGBValue<ComponentType> foo;
134};
135
136} // namespace deghosting
137
138#endif /* SUPPORT_H_ */
ComponentType operator()(vigra::RGBValue< ComponentType > v) const
Definition support.h:94
Functor to apply mexican hat function returns very small values for input near to 0 or 255.
Definition support.h:71
PixelType operator()(PixelType v) const
Definition support.h:75
vigra::RGBValue< ComponentType > operator()(vigra::RGBValue< ComponentType > const &v) const
Definition support.h:55
Logarithm functor.
Definition support.h:36
LogarithmFunctor(PixelType off=0)
Definition support.h:38
PixelType operator()(PixelType const &v) const
Definition support.h:40
vigra::RGBValue< ComponentType > operator()(vigra::RGBValue< ComponentType > const &v)
Definition support.h:129
NormalizeFunctor(vigra::RGBValue< ComponentType > oldMaxValue, vigra::RGBValue< ComponentType > newMaxValue)
Definition support.h:125
Fuctor to normalize values.
Definition support.h:107
PixelType operator()(PixelType const &v) const
Definition support.h:112
NormalizeFunctor(PixelType f)
Definition support.h:109
NormalizeFunctor(PixelType oldMaxValue, PixelType newMaxValue)
Definition support.h:110
Implementation of basic routines for deghosting algorithms Copyright (C) 2009 Lukáš Jirkovský l....
Implementation of fast vector type with support of linear algebra operations Copyright (C) 2009 Lukáš...
std::vector< deghosting::BImagePtr > threshold(const std::vector< deghosting::FImagePtr > &inputImages, const double threshold, const uint16_t flags)
Threshold function used for creating alpha masks for images.
Definition threshold.h:41