Hugintrunk  0.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PanoramaVariable.cpp
Go to the documentation of this file.
1 // -*- c-basic-offset: 4 -*-
26 #include "PanoramaVariable.h"
27 
28 #include <iostream>
29 #include <iomanip>
30 #include <utility>
31 
32 
33 namespace HuginBase {
34 
35 
36 std::ostream & Variable::print(std::ostream & o) const
37 {
38  return o << name << std::setprecision(15) << value;
39 }
40 
41 std::ostream & LensVariable::printLink(std::ostream & o,
42  unsigned int linkImage) const
43 {
44  return o << name << "=" << linkImage;
45 }
46 
47 
49 {
50  vars.insert(std::pair<const char*, Variable>("y",Variable("y",0)));
51  vars.insert(std::pair<const char*, Variable>("r",Variable("r",0)));
52  vars.insert(std::pair<const char*, Variable>("p",Variable("p",0)));
53 
54  vars.insert(std::pair<const char*, Variable>("TrX",Variable("TrX",0)));
55  vars.insert(std::pair<const char*, Variable>("TrY",Variable("TrY",0)));
56  vars.insert(std::pair<const char*, Variable>("TrZ",Variable("TrZ",0)));
57 
58  vars.insert(std::pair<const char*, Variable>("Tpy",Variable("Tpy",0)));
59  vars.insert(std::pair<const char*, Variable>("Tpp",Variable("Tpp",0)));
60 
61  vars.insert(std::pair<const char*, Variable>("j",Variable("j",0)));
62 
63  // Lens variables
64  vars.insert(std::pair<const char*, Variable>("v",Variable("v",51)));
65  vars.insert(std::pair<const char*, Variable>("a",Variable("a",0.0)));
66  vars.insert(std::pair<const char*, Variable>("b",Variable("b",0.0)));
67  vars.insert(std::pair<const char*, Variable>("c",Variable("c",0.0)));
68  vars.insert(std::pair<const char*, Variable>("d",Variable("d",0)));
69  vars.insert(std::pair<const char*, Variable>("e",Variable("e",0)));
70  vars.insert(std::pair<const char*, Variable>("g",Variable("g",0)));
71  vars.insert(std::pair<const char*, Variable>("t",Variable("t",0)));
72 
73  vars.insert(std::pair<const char*, Variable>("Va",Variable("Va",1)));
74  vars.insert(std::pair<const char*, Variable>("Vb",Variable("Vb",0)));
75  vars.insert(std::pair<const char*, Variable>("Vc",Variable("Vc",0)));
76  vars.insert(std::pair<const char*, Variable>("Vd",Variable("Vd",0)));
77  vars.insert(std::pair<const char*, Variable>("Vx",Variable("Vx",0)));
78  vars.insert(std::pair<const char*, Variable>("Vy",Variable("Vy",0)));
79 
80  // exposure value and white balance
81  vars.insert(std::pair<const char*, Variable>("Eev",Variable("Eev",0.0)));
82  vars.insert(std::pair<const char*, Variable>("Er",Variable("Er",1.0)));
83  vars.insert(std::pair<const char*, Variable>("Eb",Variable("Eb",1.0)));
84 
85  // emor response variables
86  vars.insert(std::pair<const char*, Variable>("Ra",Variable("Ra",0.0)));
87  vars.insert(std::pair<const char*, Variable>("Rb",Variable("Rb",0.0)));
88  vars.insert(std::pair<const char*, Variable>("Rc",Variable("Rc",0.0)));
89  vars.insert(std::pair<const char*, Variable>("Rd",Variable("Rd",0.0)));
90  vars.insert(std::pair<const char*, Variable>("Re",Variable("Re",0.0)));
91 }
92 
93 void fillLensVarMap(LensVarMap & variables)
94 {
95  variables.insert(std::pair<const char*, LensVariable>("v",LensVariable("v", 51, true)));
96  variables.insert(std::pair<const char*, LensVariable>("a",LensVariable("a", 0.0, true )));
97  variables.insert(std::pair<const char*, LensVariable>("b",LensVariable("b", 0.0, true)));
98  variables.insert(std::pair<const char*, LensVariable>("c",LensVariable("c", 0.0, true)));
99  variables.insert(std::pair<const char*, LensVariable>("d",LensVariable("d", 0.0, true)));
100  variables.insert(std::pair<const char*, LensVariable>("e",LensVariable("e", 0.0, true)));
101  variables.insert(std::pair<const char*, LensVariable>("g",LensVariable("g", 0.0, true)));
102  variables.insert(std::pair<const char*, LensVariable>("t",LensVariable("t", 0.0, true)));
103 
104  // vignetting correction variables
105  variables.insert(std::pair<const char*, LensVariable>("Va",LensVariable("Va", 1.0, true)));
106  variables.insert(std::pair<const char*, LensVariable>("Vb",LensVariable("Vb", 0.0, true)));
107  variables.insert(std::pair<const char*, LensVariable>("Vc",LensVariable("Vc", 0.0, true)));
108  variables.insert(std::pair<const char*, LensVariable>("Vd",LensVariable("Vd", 0.0, true)));
109  variables.insert(std::pair<const char*, LensVariable>("Vx",LensVariable("Vx", 0.0, true)));
110  variables.insert(std::pair<const char*, LensVariable>("Vy",LensVariable("Vy", 0.0, true)));
111 
112  // exposure
113  variables.insert(std::pair<const char*, LensVariable>("Eev",LensVariable("Eev", 0.0, false)));
114  variables.insert(std::pair<const char*, LensVariable>("Er",LensVariable("Er", 1.0, false)));
115  variables.insert(std::pair<const char*, LensVariable>("Eb",LensVariable("Eb", 1.0, false)));
116 
117  // emor response variables
118  variables.insert(std::pair<const char*, LensVariable>("Ra",LensVariable("Ra",0.0, true)));
119  variables.insert(std::pair<const char*, LensVariable>("Rb",LensVariable("Rb",0.0, true)));
120  variables.insert(std::pair<const char*, LensVariable>("Rc",LensVariable("Rc",0.0, true)));
121  variables.insert(std::pair<const char*, LensVariable>("Rd",LensVariable("Rd",0.0, true)));
122  variables.insert(std::pair<const char*, LensVariable>("Re",LensVariable("Re",0.0, true)));
123 }
124 
125 
126 void printVariableMap(std::ostream & o, const VariableMap & vars)
127 {
128  for ( VariableMap::const_iterator it = vars.begin(); it != vars.end();++it)
129  {
130  it->second.print(o);
131  o << " ";
132  }
133 }
134 
135 
136 } // namespace
void fillVariableMap(VariableMap &vars)
fill map with all image &amp; lens variables
void printVariableMap(std::ostream &o, const VariableMap &vars)
print a variable map to o
a variable has a value and a name.
std::map< std::string, LensVariable > LensVarMap
A lens variable can be linked.
virtual std::ostream & print(std::ostream &o) const
print this variable
std::map< std::string, Variable > VariableMap
void fillLensVarMap(LensVarMap &variables)
just lens variables
virtual std::ostream & printLink(std::ostream &o, unsigned int link) const