1 // -*- c-basic-offset: 4 -*-
2 /** @file AutoCtrlPointCreator.h
3  *
4  *  @author Pablo d'Angelo <pablo.dangelo@web.de>
5  *
6  *  This is free software; you can redistribute it and/or
7  *  modify it under the terms of the GNU General Public
8  *  License as published by the Free Software Foundation; either
9  *  version 2 of the License, or (at your option) any later version.
10  *
11  *  This software is distributed in the hope that it will be useful,
12  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  *  Lesser General Public License for more details.
15  *
16  *  You should have received a copy of the GNU General Public
17  *  License along with this software. If not, see
18  *  <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 #ifndef _AUTOCTRLPOINTCREATOR_H
23 #define _AUTOCTRLPOINTCREATOR_H
24 
25 #include <string>
26 #include <map>
27 
28 #include <hugin_shared.h>
29 #include "CPDetectorConfig.h"
30 #include "panodata/Panorama.h"
31 #include "panodata/ControlPoint.h"
32 #include "panoinc_WX.h"
33 
34 /** Base class for control point creators.
35  *
36  */
37 class ICPIMPEX AutoCtrlPointCreator
38 {
39 public:
40 
41     /** ctor.
42      */
AutoCtrlPointCreator()43     AutoCtrlPointCreator() {};
44 
45     /** dtor.
46      */
~AutoCtrlPointCreator()47     virtual ~AutoCtrlPointCreator() {};
48 
49     /** Do cp matching, calles the right routines, based
50      *  on the matcher selected
51      */
52     virtual HuginBase::CPVector automatch(CPDetectorSetting &setting, HuginBase::Panorama & pano, const HuginBase::UIntSet & imgs,
53                            int nFeatures, int & ret_value, wxWindow *parent=NULL);
54     virtual HuginBase::CPVector automatch(CPDetectorSetting &setting, HuginBase::Panorama & pano, const HuginBase::UIntSet & imgs,
55                            int nFeatures, wxWindow *parent=NULL);
56     virtual void Cleanup(CPDetectorSetting &setting, HuginBase::Panorama & pano, const HuginBase::UIntSet & imgs,
57                            std::vector<wxString> &keyFiles, wxWindow *parent=NULL);
58 
59 protected:
60     HuginBase::CPVector readUpdatedControlPoints(const std::string & file,
61                                   HuginBase::Panorama & pano, const HuginBase::UIntSet & imgs, bool reordered);
62 };
63 
64 /** A matcher that uses Sebastians Nowozin's excellent sift matcher */
65 class ICPIMPEX AutoPanoSift : public AutoCtrlPointCreator
66 {
67 public:
68 
69     /** ctor.
70      */
AutoPanoSift()71     AutoPanoSift() {};
72 
73     /** dtor.
74      */
~AutoPanoSift()75     virtual ~AutoPanoSift() {} ;
76 
77     virtual HuginBase::CPVector automatch(CPDetectorSetting &setting, HuginBase::Panorama & pano, const HuginBase::UIntSet & imgs,
78                            int nFeatures, int & ret_value, wxWindow *parent=NULL);
79     virtual HuginBase::CPVector automatch(CPDetectorSetting &setting, HuginBase::Panorama & pano, const HuginBase::UIntSet & imgs,
80                            int nFeatures, std::vector<wxString> &keyFiles, int & ret_value, wxWindow *parent=NULL);
81 };
82 
83 /** A matcher that uses Alexandres sift matcher */
84 class ICPIMPEX AutoPanoKolor : public AutoCtrlPointCreator
85 {
86 public:
87 
88     /** ctor.
89      */
AutoPanoKolor()90     AutoPanoKolor() {};
91 
92     /** dtor.
93      */
~AutoPanoKolor()94     virtual ~AutoPanoKolor() {} ;
95 
96     virtual HuginBase::CPVector automatch(CPDetectorSetting &setting, HuginBase::Panorama & pano, const HuginBase::UIntSet & imgs,
97                            int nFeatures, int & ret_value, wxWindow *parent=NULL);
98 };
99 
100 /** A matcher that uses Sebastians Nowozin's excellent sift matcher and considers stacks */
101 class ICPIMPEX AutoPanoSiftStack : public AutoCtrlPointCreator
102 {
103 public:
104 
105     /** ctor.
106      */
AutoPanoSiftStack()107     AutoPanoSiftStack() {};
108 
109     /** dtor.
110      */
~AutoPanoSiftStack()111     virtual ~AutoPanoSiftStack() {} ;
112 
113     virtual HuginBase::CPVector automatch(CPDetectorSetting &setting, HuginBase::Panorama & pano, const HuginBase::UIntSet & imgs,
114                            int nFeatures, int & ret_value, wxWindow *parent=NULL);
115 };
116 
117 /** A matcher for multi-row panoramas based on an idea by Bruno Postle */
118 class ICPIMPEX AutoPanoSiftMultiRow : public AutoCtrlPointCreator
119 {
120 public:
121 
122     /** ctor.
123      */
AutoPanoSiftMultiRow()124     AutoPanoSiftMultiRow() {};
125 
126     /** dtor.
127      */
~AutoPanoSiftMultiRow()128     virtual ~AutoPanoSiftMultiRow() {} ;
129 
130     virtual HuginBase::CPVector automatch(CPDetectorSetting &setting, HuginBase::Panorama & pano, const HuginBase::UIntSet & imgs,
131                            int nFeatures, int & ret_value, wxWindow *parent=NULL);
132 };
133 
134 /** A matcher for multi-rows, which considers stacks */
135 class ICPIMPEX AutoPanoSiftMultiRowStack : public AutoCtrlPointCreator
136 {
137 public:
138 
139     /** ctor.
140      */
AutoPanoSiftMultiRowStack()141     AutoPanoSiftMultiRowStack() {};
142 
143     /** dtor.
144      */
~AutoPanoSiftMultiRowStack()145     virtual ~AutoPanoSiftMultiRowStack() {} ;
146 
147     virtual HuginBase::CPVector automatch(CPDetectorSetting &setting, HuginBase::Panorama & pano, const HuginBase::UIntSet & imgs,
148                            int nFeatures, int & ret_value, wxWindow *parent=NULL);
149 };
150 
151 /** A matcher that uses the align information in the panorama to generate cp between overlapping images */
152 class ICPIMPEX AutoPanoSiftPreAlign : public AutoCtrlPointCreator
153 {
154 public:
155 
156     /** ctor.
157      */
AutoPanoSiftPreAlign()158     AutoPanoSiftPreAlign() {};
159 
160     /** dtor.
161      */
~AutoPanoSiftPreAlign()162     virtual ~AutoPanoSiftPreAlign() {} ;
163 
164     virtual HuginBase::CPVector automatch(CPDetectorSetting &setting, HuginBase::Panorama & pano, const HuginBase::UIntSet & imgs,
165                            int nFeatures, int & ret_value, wxWindow *parent=NULL);
166     virtual HuginBase::CPVector automatch(CPDetectorSetting &setting, HuginBase::Panorama & pano, const HuginBase::UIntSet & imgs,
167                            int nFeatures, std::vector<wxString> &keyFiles, int & ret_value, wxWindow *parent=NULL);
168 };
169 
170 #endif // _AUTOCTRLPOINTCREATOR_H
171