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 using namespace hugin_utils;
00036 
00037 
00038 Lens::Lens()
00039     : m_hasExif(false), m_projectionFormat(BaseSrcPanoImage::RECTILINEAR),
00040       m_imageSize(0,0), m_cropFactor(1.0)
00041 {
00042     fillLensVarMap(variables);
00043 }
00044 
00045 
00046 const char* Lens::variableNames[] = { "v", "a", "b", "c", "d", "e", "g", "t",
00047                                     "Va", "Vb", "Vc", "Vd", "Vx", "Vy", 
00048                                     "Eev", "Er", "Eb",
00049                                     "Ra", "Rb", "Rc", "Rd", "Re",  0};
00050 
00051 double Lens::getHFOV() const
00052 {
00053     return const_map_get(this->variables,"v").getValue();
00054 }
00055 
00056 void Lens::setHFOV(double d)
00057 {
00058     map_get(variables,"v").setValue(d);
00059 }
00060 
00061 double Lens::getFocalLength() const
00062 {
00063 
00064     double HFOV = const_map_get(variables,"v").getValue();
00065     return SrcPanoImage::calcFocalLength(m_projectionFormat,HFOV,getCropFactor(),m_imageSize);
00066 }
00067 
00068 void Lens::setEV(double ev)
00069 {
00070     map_get(variables, "Eev").setValue(ev);
00071 }
00072 
00073 double Lens::getAspectRatio() const
00074 {
00075     return (double)m_imageSize.x / m_imageSize.y;
00076 }
00077 
00078 
00079 bool Lens::isLandscape() const
00080 {
00081     return m_imageSize.x >= m_imageSize.y;
00082 }
00083 
00084 
00085 void Lens::update(const Lens & l)
00086 {
00087     m_projectionFormat = l.m_projectionFormat;
00088     m_cropFactor = l.getCropFactor();    m_imageSize = l.m_imageSize;
00089     variables = l.variables;
00090 }
00091 
00092 
00093 
00094 } //namespace

Generated on 27 Jul 2015 for Hugintrunk by  doxygen 1.4.7