[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

hugin_base/algorithms/basic/CalculateOptimalROI.h

Go to the documentation of this file.
00001 // -*- c-basic-offset: 4 -*-
00024 #ifndef _BASICALGORITHMS_CALCULATEOPTIMALROI_H
00025 #define _BASICALGORITHMS_CALCULATEOPTIMALROI_H
00026 
00027 #include <hugin_shared.h>
00028 #include <panotools/PanoToolsInterface.h>
00029 #include <algorithm/PanoramaAlgorithm.h>
00030 #include <panodata/PanoramaData.h>
00031 
00032 #include <boost/dynamic_bitset.hpp>
00033 
00034 namespace HuginBase {
00035 
00036 class IMPEX CalculateOptimalROI : public PanoramaAlgorithm
00037 {
00038     public:
00040         CalculateOptimalROI(PanoramaData& panorama)
00041          : PanoramaAlgorithm(panorama)
00042         {
00043             //set to zero for error condition
00044             o_optimalROI = vigra::Rect2D(0,0,0,0);
00045             o_optimalSize = vigra::Size2D(0,0);
00046         }
00047         
00049         virtual ~CalculateOptimalROI()
00050         {}
00051         
00052     public:
00054         virtual bool modifiesPanoramaData() const
00055             { return false; }
00056             
00058         virtual bool runAlgorithm()
00059         {
00060             printf("Run called\n");
00061             calcOptimalROI(o_panorama);
00062             return true; // let's hope so.
00063         }
00064         
00065     public:
00067         bool calcOptimalROI(PanoramaData& panorama);
00068         
00070         virtual vigra::Rect2D getResultOptimalROI()
00071         {
00072             //printf("Get Result ROI\n");
00073             //printf("Get Result ROI\n");
00074             // [TODO] if(!hasRunSuccessfully()) DEBUG;
00075             return o_optimalROI;
00076         }
00077 
00079         virtual vigra::Size2D getResultOptimalSize()
00080         {
00081             //printf("Get Result Size\n");
00082             // [TODO] if(!hasRunSuccessfully()) DEBUG;
00083             return o_optimalSize;
00084         }
00085 
00086 
00087     private:
00088         vigra::Rect2D o_optimalROI;
00089         vigra::Size2D o_optimalSize;
00090         
00091         UIntSet activeImages;
00092         std::map<unsigned int,PTools::Transform*> transfMap;
00093         //map for storing already tested pixels
00094         boost::dynamic_bitset<> testedPixels;
00095         boost::dynamic_bitset<> pixels;
00096         
00097         bool imgPixel(int i, int j);
00098         
00099         //local stuff, convert over later
00100         struct nonrec
00101         {
00102             int left,right,top,bottom;
00103             struct nonrec *next;
00104         };
00105 
00106         void makecheck(int left,int top,int right,int bottom);
00107         int autocrop();
00108         void nonreccheck(int left,int top,int right,int bottom,int acc,int dodouble);
00109         
00110         int count;
00111         struct nonrec *begin;
00112         struct nonrec *head;
00113         struct nonrec *tail;
00114         struct nonrec best;
00115         struct nonrec min;
00116         struct nonrec max;
00117 
00118         long maxvalue;
00119 };
00120 
00121 } //namespace
00122 #endif

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