Hugintrunk  0.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Lens.cpp
Go to the documentation of this file.
1 // -*- c-basic-offset: 4 -*-
2 
27 #include "Lens.h"
28 
29 #include <hugin_utils/utils.h>
30 #include <hugin_utils/stl_utils.h>
31 
32 
33 namespace HuginBase {
34 
36  : m_hasExif(false), m_projectionFormat(BaseSrcPanoImage::RECTILINEAR),
37  m_imageSize(0,0), m_cropFactor(1.0)
38 {
40 }
41 
42 
43 const char* Lens::variableNames[] = { "v", "a", "b", "c", "d", "e", "g", "t",
44  "Va", "Vb", "Vc", "Vd", "Vx", "Vy",
45  "Ra", "Rb", "Rc", "Rd", "Re", 0};
46 
47 double Lens::getHFOV() const
48 {
49  return const_map_get(this->variables,"v").getValue();
50 }
51 
52 void Lens::setHFOV(double d)
53 {
54  map_get(variables,"v").setValue(d);
55 }
56 
57 double Lens::getFocalLength() const
58 {
59 
60  double HFOV = const_map_get(variables,"v").getValue();
62 }
63 
64 double Lens::getAspectRatio() const
65 {
66  return (double)m_imageSize.x / m_imageSize.y;
67 }
68 
69 
70 bool Lens::isLandscape() const
71 {
72  return m_imageSize.x >= m_imageSize.y;
73 }
74 
75 
76 void Lens::update(const Lens & l)
77 {
80  variables = l.variables;
81 }
82 
83 
84 
85 } //namespace
LensVarMap variables
Definition: Lens.h:106
static const char * variableNames[]
Definition: Lens.h:110
bool isLandscape() const
check if the image associated with this lens is in landscape orientation.
Definition: Lens.cpp:70
double getHFOV() const
get HFOV in degrees
Definition: Lens.cpp:47
const Map::mapped_type & const_map_get(const Map &m, const typename Map::key_type &key)
Definition: stl_utils.h:110
double getFocalLength() const
get focal length of lens, it is calculated from the HFOV
Definition: Lens.cpp:57
double HFOV
vigra::Size2D m_imageSize
Definition: Lens.h:118
double getAspectRatio() const
return the sensor ratio (width/height)
Definition: Lens.cpp:64
Map::mapped_type & map_get(Map &m, const typename Map::key_type &key)
get a map element.
Definition: stl_utils.h:98
Lens()
construct a new lens.
Definition: Lens.cpp:35
Base class containing all the variables, but missing some of the other important functions and with s...
Definition: SrcPanoImage.h:67
static double calcFocalLength(SrcPanoImage::Projection proj, double hfov, double crop, vigra::Size2D imageSize)
calcualte focal length, given crop factor and hfov
void setHFOV(double d)
set HFOV in degrees
Definition: Lens.cpp:52
void fillLensVarMap(LensVarMap &variables)
just lens variables
Lens class.
void update(const Lens &l)
Definition: Lens.cpp:76
double m_cropFactor
Definition: Lens.h:119
double getCropFactor() const
get crop factor, d35mm/dreal
Definition: Lens.h:73
LensProjectionFormat m_projectionFormat
Definition: Lens.h:117