Hugin trunk 0.1
Loading...
Searching...
No Matches
PanoramaVariable.h
Go to the documentation of this file.
1// -*- c-basic-offset: 4 -*-
26#ifndef _PANODATA_PANORAMAVARIABLE_H
27#define _PANODATA_PANORAMAVARIABLE_H
28
29
30#include <hugin_shared.h>
31#include <string>
32#include <iostream>
33#include <vector>
34#include <set>
35#include <map>
36
38
39
40namespace HuginBase {
41
49{
50public :
51// in the hsi version, class Variable needs a default Ctor
52#ifdef HUGIN_HSI
53 Variable(const std::string & name = "" ,
54 double val = 0.0)
55 : name(name), value(val)
56 {};
57#else
58 Variable(const std::string & name, double val = 0.0)
59 : name(name), value(val)
60 {};
61#endif
62 virtual ~Variable()
63 {};
64
65
67 virtual std::ostream & print(std::ostream & o) const;
68
69
70 const std::string & getName() const
71 { return name; }
72
73 void setValue(double v)
74 { value = v; }
75
76 double getValue() const
77 { return value; }
78
79 protected:
80 std::string name;
81 double value;
82};
83
84
85
86// a linked variable (which contains the link target explicitly
88{
89
90 public:
91 LinkedVariable(const std::string & name = "",
92 double val = 0.0,
93 int link=-1)
94 : Variable(name, val), m_link(link)
95 {}
96
97 bool isLinked() const
98 { return m_link >= 0; }
99
100 int getLink() const
101 { return m_link; }
102
103 void setLink(int link)
104 { m_link = link; }
105
106 protected:
108};
109
110
111
117// KFJ 2011-01-12 added default for name and value parameter
118// in order to have a default contructor
119
121{
122 public:
123
124// in the hsi version, class LensVariable needs a default Ctor
125#ifdef HUGIN_HSI
126 LensVariable(const std::string & name = "" ,
127 double value = 0.0 ,
128 bool link=false)
129 : Variable(name, value), linked(link)
130 {};
131#else
132 LensVariable(const std::string & name, double value, bool link=false)
133 : Variable(name, value), linked(link)
134 {};
135#endif
137 {};
138
139
141 virtual std::ostream& printLink(std::ostream & o, unsigned int link) const;
142
143
145 bool isLinked() const
146 { return linked; }
148 void setLinked(bool l=true)
149 { linked = l; }
150
151 private:
152 bool linked;
153
154};
155
157#ifndef SWIG
158/* this gave me trouble in hsi, currently deactivated
159 * TODO: find out how it can be made to work */
161{
162 explicit PrintVar(std::ostream & o)
163 : os(o)
164 {};
165
166 void operator()(Variable x) const
167 { x.print(os) << " "; };
168
169 std::ostream& os;
170};
171#endif
172
174typedef std::map<std::string,Variable> VariableMap;
175
178
180IMPEX void printVariableMap(std::ostream & o, const VariableMap & vars);
181
183typedef std::vector<VariableMap> VariableMapVector;
184
185
187typedef std::map<std::string,LensVariable> LensVarMap;
188
190IMPEX void fillLensVarMap(LensVarMap & vars);
191
192
194typedef std::vector<std::set<std::string> > OptimizeVector;
195
196
197} // namespace
198#endif // _H
A lens variable can be linked.
void setLinked(bool l=true)
LensVariable(const std::string &name, double value, bool link=false)
LinkedVariable(const std::string &name="", double val=0.0, int link=-1)
a variable has a value and a name.
void setValue(double v)
double getValue() const
virtual std::ostream & print(std::ostream &o) const
print this variable
const std::string & getName() const
Variable(const std::string &name, double val=0.0)
#define IMPEX
mainly consists of wrapper around the pano tools library, to assist in ressource management and to pr...
Definition wxcms.cpp:39
std::vector< VariableMap > VariableMapVector
std::map< std::string, LensVariable > LensVarMap
void fillVariableMap(VariableMap &vars)
fill map with all image & lens variables
std::vector< std::set< std::string > > OptimizeVector
void fillLensVarMap(LensVarMap &variables)
just lens variables
void printVariableMap(std::ostream &o, const VariableMap &vars)
print a variable map to o
std::map< std::string, Variable > VariableMap
functor to print a variable.
void operator()(Variable x) const
PrintVar(std::ostream &o)
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