[an error occurred while processing this directive]
Main Page | Modules | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

hugin1/PT/Panorama.h

Go to the documentation of this file.
00001 // -*- c-basic-offset: 4 -*-
00024 #ifndef _Hgn1_PANORAMA_H
00025 #define _Hgn1_PANORAMA_H
00026 
00027 #include <panodata/Panorama.h>
00028 #include <panodata/PTScriptParsing.h>
00029 #include <algorithms/nona/CalculateFOV.h>
00030 #include <algorithms/nona/FitPanorama.h>
00031 #include <algorithms/basic/CalculateOptimalScale.h>
00032 #include <algorithms/basic/CalculateCPStatistics.h>
00033 #include <algorithms/nona/CenterHorizontally.h>
00034 #include <algorithms/basic/RotatePanorama.h>
00035 #include <algorithms/basic/StraightenPanorama.h>
00036 #include <algorithms/basic/CalculateMeanExposure.h>
00037 #include <algorithms/basic/CalculateOptimalROI.h>
00038 
00039 
00040 #include <typeinfo>
00041 #include "PT/PanoImage.h"
00042 #include "PT/PanoramaMemento.h"
00043 
00044 
00045 namespace PT {
00046 
00047 using HuginBase::UIntSet;
00048 using HuginBase::UIntVector;
00049 
00050 
00051 class Panorama : public HuginBase::Panorama
00052 {
00053 public:
00054     Panorama()
00055     : HuginBase::Panorama()
00056     {};
00057     
00058     Panorama(const HuginBase::Panorama& pano)
00059       : HuginBase::Panorama(pano)
00060     {};
00061     
00062     virtual ~Panorama() {};
00063     
00064     
00065 public:
00070     hugin_utils::FDiff2D calcFOV() const
00071     {
00072         Panorama pano(*this);
00073                 return HuginBase::CalculateFOV::calcFOV(pano);
00074         }
00075     
00078     void fitPano(double & HFOV, double & height)
00079     {
00080         HuginBase::CalculateFitPanorama fitPano(*this);
00081         fitPano.run();
00082         HFOV = fitPano.getResultHorizontalFOV();
00083         height = fitPano.getResultHeight();
00084     }
00085     
00092     unsigned calcOptimalWidth() const
00093     {
00094         Panorama pano(*this);
00095                 return hugin_utils::roundi(HuginBase::CalculateOptimalScale::calcOptimalScale(pano) * pano.getOptions().getWidth());
00096     }
00097     
00100     void calcOptimalROI(vigra::Rect2D & roi,vigra::Size2D & size)
00101     {
00102         printf("calcOptimalROI Called\n");
00103         HuginBase::CalculateOptimalROI cropPano(*this);
00104         
00105         cropPano.run();
00106         
00107         roi=cropPano.getResultOptimalROI();
00108         size=cropPano.getResultOptimalSize();
00109     }
00110 
00111 
00113     void calcCtrlPntsErrorStats(double & min, double & max, double & mean, double & var, int imgNr=-1) const
00114     {
00115         Panorama pano(*this);
00116         HuginBase::CalculateCPStatisticsError calcStat(pano, imgNr);
00117         calcStat.run();
00118         min = calcStat.getResultMin();
00119         max = calcStat.getResultMax();
00120         mean = calcStat.getResultMean();
00121         var = calcStat.getResultVariance();
00122     }
00123     
00125     void calcCtrlPntsRadiStats(double & min, double & max, double & mean, double & var,
00126                                double & q10, double & q90, int imgNr=-1) const
00127     {
00128         Panorama pano(*this);
00129         HuginBase::CalculateCPStatisticsRadial calcStat(pano, imgNr);
00130         calcStat.run();
00131         min = calcStat.getResultMin();
00132         max = calcStat.getResultMax();
00133         mean = calcStat.getResultMean();
00134         var = calcStat.getResultVariance();
00135         q10 = calcStat.getResultPercentile10();
00136         q90 = calcStat.getResultPercentile90();
00137     }
00138     
00140     void centerHorizontically()
00141     {
00142         HuginBase::CenterHorizontally(*this).run();
00143     }
00144     
00149     void rotate(double yaw, double pitch, double roll)
00150     {
00151         HuginBase::RotatePanorama(*this, yaw,pitch,roll).run();
00152     }
00153     
00158     void rotate(const Matrix3 & rot)
00159     {
00160         HuginBase::RotatePanorama(*this, rot).run();
00161     }
00162     
00164     void straighten()
00165     {
00166         HuginBase::StraightenPanorama(*this).run();
00167     }
00168     
00169 };
00170 
00171 
00172 class PanoramaObserver : public HuginBase::PanoramaObserver
00173 {
00174     
00175 public:
00176     virtual ~PanoramaObserver() {};
00177     
00178     
00179 public:
00180     virtual void panoramaChanged(Panorama &pano)
00181     { DEBUG_DEBUG("Default panoramaChanged called"); };
00182     
00183     
00184     virtual void panoramaImagesChanged(Panorama &pano, const UIntSet & changed)
00185     { DEBUG_DEBUG("DEFAULT handler method"); };
00186     
00187     
00188 public:
00189     virtual void panoramaChanged(HuginBase::PanoramaData& pano)
00190     {
00191             DEBUG_INFO("New interface is called.")
00192             
00193             try {
00194                 panoramaChanged(dynamic_cast<Panorama&>(pano));
00195             } catch(std::bad_cast e) {
00196                 DEBUG_WARN("Can't handle Non- PT::Panorama instance.")
00197             }
00198     };
00199     
00200     virtual void panoramaImagesChanged(HuginBase::PanoramaData& pano,
00201                                        const UIntSet& changed)
00202     {
00203         DEBUG_INFO("New interface is called.")
00204         
00205         try {
00206             panoramaImagesChanged(dynamic_cast<Panorama&>(pano), changed);
00207         } catch(std::bad_cast e) {
00208             DEBUG_WARN("Can't handle Non-PT::Panorama instance.")
00209         }
00210     };
00211 };
00212 
00213 
00214 inline double calcOptimalPanoScale(const SrcPanoImage& src,
00215                                    const PanoramaOptions& dest)
00216 {
00217     return HuginBase::CalculateOptimalScale::calcOptimalPanoScale(src, dest);
00218 }
00219 
00220 inline double calcMeanExposure(Panorama& pano)
00221 {
00222         return HuginBase::CalculateMeanExposure::calcMeanExposure(pano);
00223 }
00224 
00225 
00226 using HuginBase::PTScriptParsing::getPTParam;
00227 //using HuginBase::PTScriptParsing::getParam;
00228 using HuginBase::PTScriptParsing::getIntParam;
00229 using HuginBase::PTScriptParsing::readVar;
00230 using HuginBase::PTScriptParsing::getDoubleParam;
00231 using HuginBase::PTScriptParsing::getPTDoubleParam;
00232 
00233 
00234 
00235 } // namespace
00236 #endif // _PANORAMA_H

Generated on Mon Sep 20 01:01:26 2010 for Hugintrunk by doxygen 1.3.9.1