Hugin trunk 0.1
Loading...
Searching...
No Matches
CalculateOptimalROI.h
Go to the documentation of this file.
1// -*- c-basic-offset: 4 -*-
24#ifndef _BASICALGORITHMS_CALCULATEOPTIMALROI_H
25#define _BASICALGORITHMS_CALCULATEOPTIMALROI_H
26
27#include <hugin_shared.h>
31
32#include <vector>
33#include <list>
34
35namespace HuginBase {
36
38{
39 public:
43 {
44 //set to zero for error condition
45 m_bestRect = vigra::Rect2D(0,0,0,0);
46 o_optimalSize = vigra::Size2D(0,0);
47 }
50 {
51 //set to zero for error condition
52 m_bestRect = vigra::Rect2D(0, 0, 0, 0);
53 o_optimalSize = vigra::Size2D(0,0);
54 }
55
58
60 virtual bool modifiesPanoramaData() const
61 { return false; }
62
64 virtual bool runAlgorithm()
65 {
66 return calcOptimalROI(o_panorama);
67 }
68
70 virtual vigra::Rect2D getResultOptimalROI()
71 {
72 if (hasRunSuccessfully())
73 {
74 return m_bestRect;
75 }
76 else
77 {
78 return vigra::Rect2D();
79 }
80 }
81
83 void setStacks(std::vector<UIntSet> hdr_stacks);
84
85 private:
87 bool calcOptimalROI(PanoramaData& panorama);
88
89 vigra::Size2D o_optimalSize;
91 std::vector<UIntSet> stacks;
93 std::map<unsigned int,PTools::Transform*> transfMap;
94 //map for storing already tested pixels
95 std::vector<bool> testedPixels;
96 std::vector<bool> pixels;
97 vigra::Rect2D m_bestRect;
98
99 bool imgPixel(int i, int j);
100 bool stackPixel(int i, int j, UIntSet &stack);
101
102 //local stuff, convert over later
103 bool autocrop();
104 void nonreccheck(const vigra::Rect2D& rect, int acc, int searchStrategy, long& maxvalue);
105 bool CheckRectCoversPano(const vigra::Rect2D& rect);
106 void AddCheckingRects(std::list<vigra::Rect2D>& testingRects, const vigra::Rect2D& rect, const long maxvalue);
107
108 void CleanUp();
109};
110
112{
113public:
116 virtual bool modifiesPanoramaData() const
117 {
118 return false;
119 };
121 virtual bool runAlgorithm()
122 {
123 return CalcOutsideCrop(o_panorama, getProgressDisplay());
124 };
125
127 virtual vigra::Rect2D getResultOptimalROI();
128private:
130 bool CalcOutsideCrop(PanoramaData& pano, AppBase::ProgressDisplay* progress);
131 vigra::Rect2D m_bestRect;
132};
133
134} //namespace
135#endif
virtual bool runAlgorithm()
runs the outside crop finding algorithm
CalculateOptimalROIOutside(PanoramaData &panorama, AppBase::ProgressDisplay *progress)
constructor
virtual bool modifiesPanoramaData() const
returns true if the algorithm changes the PanoramaData.
std::map< unsigned int, PTools::Transform * > transfMap
virtual vigra::Rect2D getResultOptimalROI()
return the ROI structure?, for now area
CalculateOptimalROI(PanoramaData &panorama, AppBase::ProgressDisplay *progress, std::vector< UIntSet > hdr_stacks)
virtual ~CalculateOptimalROI()
destructor
virtual bool modifiesPanoramaData() const
returns true if the algorithm changes the PanoramaData.
CalculateOptimalROI(PanoramaData &panorama, AppBase::ProgressDisplay *progress, bool intersect=false)
constructor
virtual bool runAlgorithm()
implementation of the algorithm.
Model for a panorama.
#define IMPEX
mainly consists of wrapper around the pano tools library, to assist in ressource management and to pr...
Definition wxcms.cpp:39
std::set< unsigned int > UIntSet
void CleanUp(std::vector< InputImage * > &images)
Definition stacker.cpp:865
std::vector< deghosting::BImagePtr > threshold(const std::vector< deghosting::FImagePtr > &inputImages, const double threshold, const uint16_t flags)
Threshold function used for creating alpha masks for images.
Definition threshold.h:41