Lens.cpp

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

Generated on 21 Oct 2014 for Hugintrunk by  doxygen 1.4.7