Lens.cpp

Go to the documentation of this file.
00001 // -*- c-basic-offset: 4 -*-
00002 
00027 #include "Lens.h"
00028 
00029 #include <hugin_utils/utils.h>
00030 #include <hugin_utils/stl_utils.h>
00031 
00032 
00033 namespace HuginBase {
00034 
00035 Lens::Lens()
00036     : m_hasExif(false), m_projectionFormat(BaseSrcPanoImage::RECTILINEAR),
00037       m_imageSize(0,0), m_cropFactor(1.0)
00038 {
00039     fillLensVarMap(variables);
00040 }
00041 
00042 
00043 const char* Lens::variableNames[] = { "v", "a", "b", "c", "d", "e", "g", "t",
00044                                     "Va", "Vb", "Vc", "Vd", "Vx", "Vy", 
00045                                     "Eev", "Er", "Eb",
00046                                     "Ra", "Rb", "Rc", "Rd", "Re",  0};
00047 
00048 double Lens::getHFOV() const
00049 {
00050     return const_map_get(this->variables,"v").getValue();
00051 }
00052 
00053 void Lens::setHFOV(double d)
00054 {
00055     map_get(variables,"v").setValue(d);
00056 }
00057 
00058 double Lens::getFocalLength() const
00059 {
00060 
00061     double HFOV = const_map_get(variables,"v").getValue();
00062     return SrcPanoImage::calcFocalLength(m_projectionFormat,HFOV,getCropFactor(),m_imageSize);
00063 }
00064 
00065 void Lens::setEV(double ev)
00066 {
00067     map_get(variables, "Eev").setValue(ev);
00068 }
00069 
00070 double Lens::getAspectRatio() const
00071 {
00072     return (double)m_imageSize.x / m_imageSize.y;
00073 }
00074 
00075 
00076 bool Lens::isLandscape() const
00077 {
00078     return m_imageSize.x >= m_imageSize.y;
00079 }
00080 
00081 
00082 void Lens::update(const Lens & l)
00083 {
00084     m_projectionFormat = l.m_projectionFormat;
00085     m_cropFactor = l.getCropFactor();    m_imageSize = l.m_imageSize;
00086     variables = l.variables;
00087 }
00088 
00089 
00090 
00091 } //namespace

Generated on 30 Jul 2016 for Hugintrunk by  doxygen 1.4.7