Hugin trunk 0.1
Loading...
Searching...
No Matches
PanoramaData.h
Go to the documentation of this file.
1// -*- c-basic-offset: 4 -*-
26#ifndef _PANORAMA_H
27#define _PANORAMA_H
28
29// if this file is preprocessed for SWIG, we want to ignore
30// all the header inclusions that follow:
31
32#ifndef _HSI_IGNORE_SECTION
33
34#include <hugin_shared.h>
35#include <vector>
36#include <set>
37#include <iostream>
38
39#include <hugin_math/Matrix3.h>
43#include <panodata/Lens.h>
45
46#endif // _HSI_IGNORE_SECTION
47
48namespace HuginBase {
49
51typedef std::set<unsigned int> UIntSet;
52
54typedef std::vector<unsigned int> UIntVector;
55
56typedef std::vector<UIntSet> UIntSetVector;
57
82{
83
84public:
85
87 virtual ~PanoramaData() {};
88
89
90 /* get a subset of the panorama
91 *
92 * This returns a panorama that contains only the images specified by \imgs
93 * Useful for operations on a subset of the panorama
94 */
95// virtual Panorama getSubset(const UIntSet& imgs) const;
96
97 /* duplicate the panorama
98 *
99 * returns a copy of the pano state, except for the listeners.
100 */
101// virtual Panorama duplicate() const;
102
104 virtual PanoramaData* getNewSubset(const UIntSet& imgs) const =0;
105
107 virtual PanoramaData* getNewCopy() const =0;
108
110
111// -- Data Access --
112
113// = images =
114
116 virtual std::size_t getNrOfImages() const =0;
117
119 virtual const SrcPanoImage& getImage(std::size_t nr) const =0;
120
122 virtual void setImage(std::size_t nr, const SrcPanoImage & img) =0;
123
125// virtual unsigned int getImageNr(const PanoImage * image) const =0;
126
132 virtual unsigned int addImage(const SrcPanoImage& img) =0;
133
135// virtual int addImageAndLens(const std::string & filename) =0;
136
140// virtual unsigned int addImage(const std::string & filename) =0;
141
146 virtual void removeImage(unsigned int nr) =0;
147
152 virtual void swapImages(unsigned int img1, unsigned int img2) =0;
153
158 virtual void moveImage(size_t img1, size_t img2) =0;
159
161 virtual SrcPanoImage getSrcImage(unsigned imgNr) const =0;
162
166 virtual void setSrcImage(unsigned int nr, const SrcPanoImage & img) =0;
167
174 virtual void setImageFilename(unsigned int img, const std::string & fname) =0;
175
187 virtual void activateImage(unsigned int imgNr, bool active=true) =0;
188
190 virtual UIntSet getActiveImages() const =0;
191
192 /* Link image variable functions. Used to group image variables which
193 * should share the same value. The initial value is the one kept by
194 * the image with number sourceImgNr.
195 */
196#define image_variable( name, type, default_value ) \
197 virtual void linkImageVariable##name(unsigned int sourceImgNr, unsigned int destImgNr) =0;
198#include "image_variables.h"
199#undef image_variable
200
201 /* Unlink image variable functions. Makes a image variable independant
202 * of the other images.
203 */
204#define image_variable( name, type, default_value ) \
205 virtual void unlinkImageVariable##name(unsigned int imgNr) =0;
206#include "image_variables.h"
207#undef image_variable
208
209
210// = CPs =
211
213 virtual std::size_t getNrOfCtrlPoints() const =0;
214
216 virtual const ControlPoint & getCtrlPoint(std::size_t nr) const =0;
217
219 virtual const CPVector & getCtrlPoints() const =0;
220
222 virtual std::vector<unsigned int> getCtrlPointsForImage(unsigned int imgNr) const =0;
223
225 virtual void setCtrlPoints(const CPVector & points) =0;
226
228 virtual unsigned int addCtrlPoint(const ControlPoint & point) =0;
229
232 virtual void removeCtrlPoint(unsigned int pNr) =0;
233
236 virtual void removeDuplicateCtrlPoints() =0;
237
240 virtual void changeControlPoint(unsigned int pNr, const ControlPoint & point) =0;
241
243// virtual unsigned int getCtrlPointNr(const ControlPoint * point) const =0;
244
246 virtual int getNextCPTypeLineNumber() const =0;
247
249 virtual void updateLineCtrlPoints() =0;
250
251
259
266 virtual void updateCtrlPointErrors(const UIntSet & imgs, const CPVector & cps) =0;
267
268// = Variables =
269/* TODO most of this section needs fixing. The image variables are now stored
270 * in SrcPanoImage objects, the PanoramaData object should just duplicate
271 * the changes across all images sharing variables.
272 * We also need access to the links of the variables.
273 * At some point, this functions should be removed. Do not create new
274 * code using them. Instead, use getSrcImage.
275 */
277 virtual VariableMapVector getVariables() const =0;
278
289 virtual const VariableMap getImageVariables(unsigned int imgNr) const =0;
290
296 virtual void updateVariables(const VariableMapVector & vars) =0;
297
299 virtual void updateVariables(const UIntSet & imgs, const VariableMapVector & var) =0;
300
304 virtual void updateVariables(unsigned int imgNr, const VariableMap & var) =0;
305
310 virtual void updateVariable(unsigned int imgNr, const Variable &var) =0;
311
315 virtual void updateWhiteBalance(double redFactor, double blueFactor) =0;
316
317// = Optimise Vector =
318
320 virtual const OptimizeVector & getOptimizeVector() const =0;
321
323 virtual void setOptimizeVector(const OptimizeVector & optvec) =0;
324
325
327 virtual const int getOptimizerSwitch() const =0;
329 virtual void setOptimizerSwitch(const int newSwitch) =0;
330
332 virtual const int getPhotometricOptimizerSwitch() const =0;
334 virtual void setPhotometricOptimizerSwitch(const int newSwitch) =0;
335
336// = Panorama options =
337
339 virtual const PanoramaOptions & getOptions() const =0;
340
345 virtual void setOptions(const PanoramaOptions & opt) =0;
346
347
348
349// -- script interface --
350
352 virtual void printPanoramaScript(std::ostream & o,
353 const OptimizeVector & optvars,
354 const PanoramaOptions & options,
355 const UIntSet & imgs,
356 bool forPTOptimizer,
357 const std::string & stripPrefix="") const =0;
358
360 virtual void printStitcherScript(std::ostream & o,
361 const PanoramaOptions & target,
362 const UIntSet & imgs) const =0;
363
364
365// -- maintainance --
366
367public:
369 virtual void changeFinished() =0;
370
372 virtual void imageChanged(unsigned int imgNr) =0;
374 virtual void updateMasksForImage(unsigned int imgNr, MaskPolygonVector newMasks)=0;
380 virtual void updateMasks(bool convertPosMaskToNeg=false)=0;
383 virtual void transferMask(MaskPolygon mask,unsigned int imgNr, const UIntSet& targetImgs)=0;
385 virtual void updateOptimizeVector()=0;
387 virtual std::set<size_t> getRefImages()=0;
391
392};
393
394
395
402{
403 public:
404
406 virtual ~PanoramaObserver() {};
407
418 virtual void panoramaChanged(Panorama &pano) =0;
419
429 virtual void panoramaImagesChanged(Panorama& pano,
430 const UIntSet& changed) =0;
431
432
433};
434
435
444{
445 protected:
448
449 public:
452};
453
454
457{
458 public:
459
462
463
464 // -- Observing --
465
466 public:
473 virtual void addObserver(PanoramaObserver *o) =0;
474
484
489 virtual void clearObservers() =0;
490
497 virtual void changeFinished() =0;
498
500 virtual void clearDirty() =0;
501
507 virtual void imageChanged(unsigned int imgNr) =0;
508
509
510 // -- Memento interface --
511
512 public:
515
517 virtual bool setMementoToCopyOf(const PanoramaDataMemento* const memento) =0;
518
519
520 // -- Optimization Status --
521
522 public:
526 virtual bool needsOptimization() =0;
527
529 virtual void markAsOptimized(bool optimized=true) =0;
530
531};
532
533
534} // namespace
535
536
537
538
539#endif // _PANORAMA_H
Lens class.
represents a control point
virtual void clearDirty()=0
clear dirty flag.
virtual void imageChanged(unsigned int imgNr)=0
mark image for change notification.
virtual bool removeObserver(PanoramaObserver *observer)=0
remove a panorama observer.
virtual void markAsOptimized(bool optimized=true)=0
virtual bool setMementoToCopyOf(const PanoramaDataMemento *const memento)=0
set the internal state
virtual void changeFinished()=0
notify observers about changes in this class
virtual void clearObservers()=0
remove all panorama observers.
virtual bool needsOptimization()=0
true if control points or lens variables have been changed after the last optimisation
virtual void addObserver(PanoramaObserver *o)=0
add a panorama observer.
virtual PanoramaDataMemento * getNewMemento() const =0
get the internal state
base class, which stores one mask polygon
Definition Mask.h:53
Memento class for a PanoramaData object.
PanoramaDataMemento()
force pure abstract behaviour
Model for a panorama.
virtual std::size_t getNrOfCtrlPoints() const =0
number of control points
virtual void setOptions(const PanoramaOptions &opt)=0
set new output settings This is not used directly for optimizing/stiching, but it can be feed into ru...
virtual const ControlPoint & getCtrlPoint(std::size_t nr) const =0
get a control point, counting starts with 0
virtual const OptimizeVector & getOptimizeVector() const =0
return the optimize settings stored inside panorama
virtual VariableMapVector getVariables() const =0
get variables of this panorama
virtual void changeControlPoint(unsigned int pNr, const ControlPoint &point)=0
change a control Point.
virtual const PanoramaOptions & getOptions() const =0
returns the options for this panorama
virtual const VariableMap getImageVariables(unsigned int imgNr) const =0
get variables of an image
virtual void updateLineCtrlPoints()=0
assign new mode line numbers, if required
virtual void checkRefOptStatus(bool &linkRefImgsYaw, bool &linkRefImgsPitch, bool &linkRefImgsRoll)=0
checks if yaw/pitch/roll of reference image can be check, it depends on number and type of control po...
virtual void changeFinished()=0
tells the data container to perform some maintainance if neccesary
virtual void setSrcImage(unsigned int nr, const SrcPanoImage &img)=0
set input image parameters TODO: Propagate changes to linked images.
virtual UIntSet getActiveImages() const =0
get active images
virtual void updateCtrlPointErrors(const CPVector &controlPoints)=0
update control points distances.
virtual void updateOptimizeVector()=0
updates the optimize vector according to master switches
virtual void setOptimizerSwitch(const int newSwitch)=0
set optimizer master switch
virtual void printPanoramaScript(std::ostream &o, const OptimizeVector &optvars, const PanoramaOptions &options, const UIntSet &imgs, bool forPTOptimizer, const std::string &stripPrefix="") const =0
create an optimizer script
virtual const int getPhotometricOptimizerSwitch() const =0
return the photometric optimizer master switch
virtual void moveImage(size_t img1, size_t img2)=0
moves images.
virtual void setOptimizeVector(const OptimizeVector &optvec)=0
set optimize setting
virtual void removeCtrlPoint(unsigned int pNr)=0
remove a control point.
virtual void imageChanged(unsigned int imgNr)=0
mark image change for maintainance
virtual const int getOptimizerSwitch() const =0
returns optimizer master switch
virtual void setImageFilename(unsigned int img, const std::string &fname)=0
set a new image filename
virtual void removeDuplicateCtrlPoints()=0
removes duplicates control points
virtual PanoramaData * getNewSubset(const UIntSet &imgs) const =0
virtual SrcPanoImage getSrcImage(unsigned imgNr) const =0
get a complete description of a source image
virtual void updateWhiteBalance(double redFactor, double blueFactor)=0
update the global white balace of the panorama by multiplying the red and blue factor of each image w...
virtual void swapImages(unsigned int img1, unsigned int img2)=0
swap images.
virtual void updateVariable(unsigned int imgNr, const Variable &var)=0
update a single variable
virtual void setPhotometricOptimizerSwitch(const int newSwitch)=0
sets the photometric optimizer master switch
virtual void updateVariables(const UIntSet &imgs, const VariableMapVector &var)=0
update variables for some specific images
virtual void updateVariables(unsigned int imgNr, const VariableMap &var)=0
Set variables for a single picture.
virtual const CPVector & getCtrlPoints() const =0
get all control point of this Panorama
virtual void printStitcherScript(std::ostream &o, const PanoramaOptions &target, const UIntSet &imgs) const =0
create the stitcher script
virtual void setImage(std::size_t nr, const SrcPanoImage &img)=0
set a panorama image, counting starts with 0
virtual int getNextCPTypeLineNumber() const =0
get the number of a control point
virtual const SrcPanoImage & getImage(std::size_t nr) const =0
get a panorama image, counting starts with 0
virtual void updateVariables(const VariableMapVector &vars)=0
Set the variables.
virtual std::size_t getNrOfImages() const =0
number of images.
virtual void transferMask(MaskPolygon mask, unsigned int imgNr, const UIntSet &targetImgs)=0
transfers given mask from image imgNr to all targetImgs
virtual unsigned int addImage(const SrcPanoImage &img)=0
the the number for a specific image
virtual std::vector< unsigned int > getCtrlPointsForImage(unsigned int imgNr) const =0
return all control points for a given image.
virtual void activateImage(unsigned int imgNr, bool active=true)=0
mark an image as active or inactive.
virtual unsigned int addCtrlPoint(const ControlPoint &point)=0
add a new control point.
virtual void updateCtrlPointErrors(const UIntSet &imgs, const CPVector &cps)=0
update control points for a subset of images.
virtual PanoramaData * getUnlinkedSubset(UIntSetVector &imageGroups) const =0
virtual void updateMasks(bool convertPosMaskToNeg=false)=0
updates all active masks
virtual void removeImage(unsigned int nr)=0
creates an image, from filename, and a Lens, if needed
virtual PanoramaData * getNewCopy() const =0
virtual void updateMasksForImage(unsigned int imgNr, MaskPolygonVector newMasks)=0
set complete mask list for image with number
virtual std::set< size_t > getRefImages()=0
returns set of reference image and images linked with reference images
virtual void setCtrlPoints(const CPVector &points)=0
set all control points (Ippei: Is this supposed to be 'add' method?)
this handler class will receive change events from the Panorama.
virtual void panoramaImagesChanged(Panorama &pano, const UIntSet &changed)=0
notifies about changes to images
virtual void panoramaChanged(Panorama &pano)=0
Notification about a Panorama change.
Panorama image options.
Model for a panorama.
Definition Panorama.h:153
All variables of a source image.
a variable has a value and a name.
#define IMPEX
This file specifies what image variables SrcPanoImg should have.
mainly consists of wrapper around the pano tools library, to assist in ressource management and to pr...
Definition wxcms.cpp:39
std::vector< unsigned int > UIntVector
std::vector< MaskPolygon > MaskPolygonVector
Definition Mask.h:150
std::vector< VariableMap > VariableMapVector
std::vector< ControlPoint > CPVector
std::vector< std::set< std::string > > OptimizeVector
std::vector< UIntSet > UIntSetVector
std::set< unsigned int > UIntSet
std::map< std::string, Variable > VariableMap
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