Hugin trunk 0.1
Loading...
Searching...
No Matches
PanoCommand.h
Go to the documentation of this file.
1// -*- c-basic-offset: 4 -*-
24#ifndef _Hgn1_PANOCOMMAND_H
25#define _Hgn1_PANOCOMMAND_H
26
27
28#include "Command.h"
29
30#include "panodata/Panorama.h"
32
33namespace PanoCommand
34{
40 {
41 public:
46 CombinedPanoCommand(HuginBase::Panorama & pano, std::vector<PanoCommand*> & commands)
47 : PanoCommand(pano), commands(commands) { setName("multiple commands");};
49 virtual bool processPanorama(HuginBase::Panorama & pano);
50 private:
51 std::vector<PanoCommand*> commands;
52 };
53
56 {
57 public:
58 explicit NewPanoCmd(HuginBase::Panorama & pano) : PanoCommand(pano) { m_clearDirty = true; };
59 virtual bool processPanorama(HuginBase::Panorama& pano);
60 virtual std::string getName() const { return "new panorama"; };
61 };
62
65 {
66 public:
67 AddImagesCmd(HuginBase::Panorama & pano, const std::vector<HuginBase::SrcPanoImage> & images)
68 : PanoCommand(pano), imgs(images) { };
69 virtual bool processPanorama(HuginBase::Panorama& pano);
70 virtual std::string getName() const { return "add images"; };
71 private:
72 std::vector<HuginBase::SrcPanoImage> imgs;
73 };
74
80 {
81 public:
82 RemoveImageCmd(HuginBase::Panorama & p, unsigned int imgNr)
83 : PanoCommand(p), imgNr(imgNr)
84 { };
85
86 virtual bool processPanorama(HuginBase::Panorama& pano);
87 virtual std::string getName() const { return "remove image"; };
88 private:
89 unsigned int imgNr;
90 };
91
95 {
96 public:
98 virtual bool processPanorama(HuginBase::Panorama& pano);
99 virtual std::string getName() const { return "remove images"; };
100 private:
102 };
103
106 {
107 public:
110 virtual bool processPanorama(HuginBase::Panorama& pano);
111 virtual std::string getName() const { return "update variables"; };
112 private:
114 };
115
118 {
119 public:
121 : PanoCommand(p), cps(cps), updateCPError(doUpdateCPError)
122 { };
123 virtual bool processPanorama(HuginBase::Panorama& pano);
124 virtual std::string getName() const { return "update control points"; };
125 private:
128 };
129
132 {
133 public:
135 : PanoCommand(p), vars(vars), cps(cps)
136 { };
137 virtual bool processPanorama(HuginBase::Panorama& pano);
138 virtual std::string getName() const { return "update variables and control points"; };
139 private:
142 };
143
146 {
147 public:
149 : PanoCommand(p), m_imgs(imgs), vars(vars), cps(cps)
150 { };
151 virtual bool processPanorama(HuginBase::Panorama& pano);
152 virtual std::string getName() const { return "update variables and control points"; };
153 private:
157 };
158
161 {
162 public:
164 : PanoCommand(p), imgNr(ImgNr), vars(vars)
165 { };
166 virtual bool processPanorama(HuginBase::Panorama& pano);
167 virtual std::string getName() const { return "update image variables"; };
168 private:
169 unsigned int imgNr;
171 };
172
175 {
176 public:
178 : PanoCommand(p), change(change), vars(vars)
179 { };
180 virtual bool processPanorama(HuginBase::Panorama& pano);
181 virtual std::string getName() const { return "update image variables"; }
182 private:
185 };
186
189 {
190 public:
191 UpdateVariablesByParseExpression(HuginBase::Panorama & p, const std::string& expression)
192 : PanoCommand(p), m_expression(expression)
193 { };
194 virtual bool processPanorama(HuginBase::Panorama& pano);
195 virtual std::string getName() const { return "update image variables by parsing expression"; }
196 private:
197 std::string m_expression;
198 };
199
202 {
203 public:
207 virtual bool processPanorama(HuginBase::Panorama & pano);
208 virtual std::string getName() const { return "update optimize vector"; }
209 private:
211 };
212
215 {
216 public:
217 UpdateOptimizerSwitchCmd(HuginBase::Panorama &p, int mode) : PanoCommand(p), m_mode(mode) { };
218 virtual bool processPanorama(HuginBase::Panorama & pano);
219 virtual std::string getName() const { return "update optimizer master switch"; }
220 private:
222 };
223
226 {
227 public:
229 virtual bool processPanorama(HuginBase::Panorama & pano);
230 virtual std::string getName() const { return "update photometric optimizer master switch"; }
231 private:
233 };
234
237 {
238 public:
240 : PanoCommand(p), images(images), var(var)
241 { };
242 virtual bool processPanorama(HuginBase::Panorama& pano);
243 virtual std::string getName() const { return "set image variable"; }
244 private:
247 };
248
251 {
252 public:
254 virtual bool processPanorama(HuginBase::Panorama& pano);
255 virtual std::string getName() const { return "center panorama"; }
256 };
257
260 {
261 public:
263 virtual bool processPanorama(HuginBase::Panorama& pano);
264 virtual std::string getName() const { return "straighten panorama"; };
265 };
266
269 {
270 public:
274 virtual bool processPanorama(HuginBase::Panorama& pano);
275 virtual std::string getName() const { return "add control point"; };
276 private:
278 };
279
282 {
283 public:
287 virtual bool processPanorama(HuginBase::Panorama& pano);
288 virtual std::string getName() const { return "add control points"; };
289 private:
291 };
292
295 {
296 public:
298 : PanoCommand(p), pointNr(cpNr)
299 { }
300 virtual bool processPanorama(HuginBase::Panorama& pano);
301 virtual std::string getName() const { return "remove control point"; };
302 private:
303 unsigned int pointNr;
304 };
305
308 {
309 public:
313 virtual bool processPanorama(HuginBase::Panorama& pano);
314 virtual std::string getName() const { return "remove control points"; };
315 private:
317 };
318
321 {
322 public:
324 : PanoCommand(p), pNr(nr), point(point)
325 {};
326 virtual bool processPanorama(HuginBase::Panorama& pano);
327 virtual std::string getName() const { return "change control point"; };
328 private:
329 unsigned int pNr;
331 };
332
335 {
336 public:
338 : PanoCommand(p), m_active(active)
339 { };
340 virtual bool processPanorama(HuginBase::Panorama& pano);
341 virtual std::string getName() const { return "change active images"; };
342 private:
344 };
345
348 {
349 public:
350 SwapImagesCmd(HuginBase::Panorama & p, unsigned int i1, unsigned int i2)
351 : PanoCommand(p), m_i1(i1), m_i2(i2)
352 { };
353 virtual bool processPanorama(HuginBase::Panorama& pano);
354 virtual std::string getName() const { return "swap images"; };
355 private:
356 unsigned int m_i1;
357 unsigned int m_i2;
358 };
359
362 {
363 public:
364 MoveImageCmd(HuginBase::Panorama & p, size_t i1, size_t i2)
365 : PanoCommand(p), m_i1(i1), m_i2(i2)
366 { };
367 virtual bool processPanorama(HuginBase::Panorama& pano);
368 virtual std::string getName() const { return "move images"; };
369 private:
370 unsigned int m_i1;
371 unsigned int m_i2;
372 };
373
376 {
377 public:
379 : PanoCommand(p), newPano(p2)
380 { };
381 virtual bool processPanorama(HuginBase::Panorama& pano);
382 virtual std::string getName() const { return "merge panorama"; };
383 private:
385 };
386
390 {
391 public:
393 : PanoCommand(p), img(img), imgNr(i)
394 { };
395 virtual bool processPanorama(HuginBase::Panorama& pano);
396 virtual std::string getName() const{ return "update source image"; };
397 private:
399 unsigned imgNr;
400 };
401
405 {
406 public:
407 UpdateSrcImagesCmd(HuginBase::Panorama & p, HuginBase::UIntSet i, std::vector<HuginBase::SrcPanoImage> imgs)
408 : PanoCommand(p), imgs(imgs), imgNrs(i)
409 { };
410 virtual bool processPanorama(HuginBase::Panorama& pano);
411 virtual std::string getName() const { return "update source images"; };
412 private:
413 std::vector<HuginBase::SrcPanoImage> imgs;
415 };
416
419 {
420 public:
422 : PanoCommand(p), options(opts)
423 { };
424 virtual bool processPanorama(HuginBase::Panorama& pano);
425 virtual std::string getName() const { return "set panorama options"; };
426 private:
428 };
429
436 {
437 public:
438 LoadPTProjectCmd(HuginBase::Panorama & p, const std::string & filename, const std::string & prefix = "");
439 virtual bool processPanorama(HuginBase::Panorama& pano);
440 virtual std::string getName() const { return "load project"; };
441 private:
442 const std::string &filename;
443 const std::string &prefix;
444 };
445
449 {
450 public:
451 RotatePanoCmd(HuginBase::Panorama & p, double yaw, double pitch, double roll)
452 : PanoCommand(p), y(yaw), p(pitch), r(roll)
453 { };
454 virtual bool processPanorama(HuginBase::Panorama& pano);
455 virtual std::string getName() const { return "rotate panorama"; };
456 private:
457 double y, p, r;
458 };
459
463 {
464 public:
465 TranslatePanoCmd(HuginBase::Panorama & p, double TrX, double TrY, double TrZ)
466 : PanoCommand(p), X(TrX), Y(TrY), Z(TrZ)
467 { };
468 virtual bool processPanorama(HuginBase::Panorama& pano);
469 virtual std::string getName() const{ return "translate panorama"; };
470 private:
471 double X, Y, Z;
472 };
473
477 {
478 public:
480 : PanoCommand(p), imgNrs(imgs), m_focalLength(newFocalLength)
481 { };
482 virtual bool processPanorama(HuginBase::Panorama& pano);
483 virtual std::string getName() const { return "update focal length"; };
484 private:
487 };
488
492 {
493 public:
495 : PanoCommand(p), imgNrs(imgs), m_cropFactor(newCropFactor)
496 { };
497 virtual bool processPanorama(HuginBase::Panorama& pano);
498 virtual std::string getName() const { return "update crop factor"; };
499 private:
502 };
503
507 {
508 public:
509 ChangePartNumberCmd(HuginBase::Panorama & p, HuginBase::UIntSet image_numbers, std::size_t new_part_number,
510 std::set<HuginBase::ImageVariableGroup::ImageVariableEnum> variables)
511 : PanoCommand(p), image_numbers(image_numbers), new_part_number(new_part_number),variables(variables)
512 { };
513 virtual bool processPanorama(HuginBase::Panorama& pano);
514 virtual std::string getName() const { return "Change part number"; };
515 private:
517 std::size_t new_part_number;
518 std::set<HuginBase::ImageVariableGroup::ImageVariableEnum> variables;
519 };
520
525 {
526 public:
538 HuginBase::UIntSet image_numbers, std::set<HuginBase::ImageVariableGroup::ImageVariableEnum> changeVariables,
539 bool new_linked_state, std::set<HuginBase::ImageVariableGroup::ImageVariableEnum> groupVariables)
540 : PanoCommand(p), image_numbers(image_numbers), changeVariables(changeVariables),
541 new_linked_state(new_linked_state), groupVariables(groupVariables)
542 { };
543 virtual bool processPanorama(HuginBase::Panorama& pano);
544 virtual std::string getName() const { return "Change image variable links"; };
545 private:
547 std::set<HuginBase::ImageVariableGroup::ImageVariableEnum> changeVariables;
549 std::set<HuginBase::ImageVariableGroup::ImageVariableEnum> groupVariables;
550 };
551
555 {
556 public:
557 LinkLensVarsCmd(HuginBase::Panorama & p, std::size_t lens_number, std::set<HuginBase::ImageVariableGroup::ImageVariableEnum> variables)
558 : PanoCommand(p), lens_number(lens_number), variables(variables)
559 { };
560 virtual bool processPanorama(HuginBase::Panorama& pano);
561 virtual std::string getName() const { return "Link lens variables"; };
562 private:
563 std::size_t lens_number;
564 std::set<HuginBase::ImageVariableGroup::ImageVariableEnum> variables;
565 };
566
568#define image_variable( name, type, default_value )\
569 class WXIMPEX ChangeImage##name##Cmd : public PanoCommand\
570 {\
571 public:\
572 ChangeImage##name##Cmd(HuginBase::Panorama & p,\
573 HuginBase::UIntSet image_numbers,\
574 type value)\
575 : PanoCommand(p),\
576 image_numbers(image_numbers),\
577 value(value)\
578 { };\
579 virtual bool processPanorama(HuginBase::Panorama& pano);\
580 virtual std::string getName() const { return "Change image's " #name; };\
581 private:\
582 HuginBase::UIntSet image_numbers;\
583 type value;\
584 };
586#undef image_variable
587
592 {
593 public:
601 NewPartCmd(HuginBase::Panorama & p, HuginBase::UIntSet image_numbers, std::set<HuginBase::ImageVariableGroup::ImageVariableEnum> vars)
602 : PanoCommand(p), image_numbers(image_numbers), vars(vars)
603 { }
604 virtual bool processPanorama(HuginBase::Panorama& pano);
605 virtual std::string getName() const { return "New Part"; };
606 private:
608 std::set<HuginBase::ImageVariableGroup::ImageVariableEnum> vars;
609 };
610
613 {
614 public:
616 : PanoCommand(p), m_img(img), m_mask(mask)
617 { };
618 virtual bool processPanorama(HuginBase::Panorama& pano);
619 virtual std::string getName() const { return "update mask"; };
620 private:
621 unsigned int m_img;
623 };
624
627 {
628 public:
630 : PanoCommand(p), m_red(redFactor), m_blue(blueFactor)
631 { };
632 virtual bool processPanorama(HuginBase::Panorama& pano);
633 virtual std::string getName() const { return "update global white balance"; };
634 private:
635 double m_red;
636 double m_blue;
637 };
638
641 {
642 public:
644 virtual bool processPanorama(HuginBase::Panorama& pano);
645 virtual std::string getName() const { return "set exposure to mean exposure"; };
646 };
647
650 {
651 public:
653 virtual bool processPanorama(HuginBase::Panorama& pano);
654 virtual std::string getName() const { return "distribute images"; };
655 };
656
657
658} // namespace PanoCommand
659
660#endif // _PANOCOMMAND_H
Somewhere to specify what variables belong to what.
represents a control point
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.
add a control point
HuginBase::ControlPoint point
AddCtrlPointCmd(HuginBase::Panorama &p, const HuginBase::ControlPoint &cpoint)
virtual std::string getName() const
returns the name of the command
add multiple control points
AddCtrlPointsCmd(HuginBase::Panorama &p, const HuginBase::CPVector &cpoints)
virtual std::string getName() const
returns the name of the command
HuginBase::CPVector cps
add image(s) to a panorama
Definition PanoCommand.h:65
virtual std::string getName() const
returns the name of the command
Definition PanoCommand.h:70
AddImagesCmd(HuginBase::Panorama &pano, const std::vector< HuginBase::SrcPanoImage > &images)
Definition PanoCommand.h:67
std::vector< HuginBase::SrcPanoImage > imgs
Definition PanoCommand.h:72
center panorama horizontically
CenterPanoCmd(HuginBase::Panorama &p)
virtual std::string getName() const
returns the name of the command
change a control point
ChangeCtrlPointCmd(HuginBase::Panorama &p, unsigned int nr, HuginBase::ControlPoint point)
virtual std::string getName() const
returns the name of the command
HuginBase::ControlPoint point
Change the linking of some variables across parts of an ImageVariableGroup containing some specified ...
std::set< HuginBase::ImageVariableGroup::ImageVariableEnum > groupVariables
virtual std::string getName() const
returns the name of the command
std::set< HuginBase::ImageVariableGroup::ImageVariableEnum > changeVariables
ChangePartImagesLinkingCmd(HuginBase::Panorama &p, HuginBase::UIntSet image_numbers, std::set< HuginBase::ImageVariableGroup::ImageVariableEnum > changeVariables, bool new_linked_state, std::set< HuginBase::ImageVariableGroup::ImageVariableEnum > groupVariables)
Constructor.
Switch the part number of an image.
std::set< HuginBase::ImageVariableGroup::ImageVariableEnum > variables
ChangePartNumberCmd(HuginBase::Panorama &p, HuginBase::UIntSet image_numbers, std::size_t new_part_number, std::set< HuginBase::ImageVariableGroup::ImageVariableEnum > variables)
virtual std::string getName() const
returns the name of the command
HuginBase::UIntSet image_numbers
PanoCommand to combine other PanoCommands.
Definition PanoCommand.h:40
CombinedPanoCommand(HuginBase::Panorama &pano, std::vector< PanoCommand * > &commands)
Constructor.
Definition PanoCommand.h:46
std::vector< PanoCommand * > commands
Definition PanoCommand.h:51
distributes all images above the sphere, for the assistant
virtual std::string getName() const
returns the name of the command
DistributeImagesCmd(HuginBase::Panorama &p)
Link a set of lens variables for some lens.
virtual std::string getName() const
returns the name of the command
LinkLensVarsCmd(HuginBase::Panorama &p, std::size_t lens_number, std::set< HuginBase::ImageVariableGroup::ImageVariableEnum > variables)
std::set< HuginBase::ImageVariableGroup::ImageVariableEnum > variables
dump the current project and load a new one.
const std::string & prefix
virtual std::string getName() const
returns the name of the command
const std::string & filename
merge two project files
virtual std::string getName() const
returns the name of the command
MergePanoCmd(HuginBase::Panorama &p, HuginBase::Panorama &p2)
HuginBase::Panorama newPano
move image from position1 to position2
MoveImageCmd(HuginBase::Panorama &p, size_t i1, size_t i2)
virtual std::string getName() const
returns the name of the command
reset the panorama
Definition PanoCommand.h:56
NewPanoCmd(HuginBase::Panorama &pano)
Definition PanoCommand.h:58
virtual std::string getName() const
returns the name of the command
Definition PanoCommand.h:60
Make a new part in a ImageVariableGroup for a set of images, given the variables that make up the gro...
std::set< HuginBase::ImageVariableGroup::ImageVariableEnum > vars
NewPartCmd(HuginBase::Panorama &p, HuginBase::UIntSet image_numbers, std::set< HuginBase::ImageVariableGroup::ImageVariableEnum > vars)
Constructor.
HuginBase::UIntSet image_numbers
virtual std::string getName() const
returns the name of the command
remove a control point
RemoveCtrlPointCmd(HuginBase::Panorama &p, unsigned int cpNr)
virtual std::string getName() const
returns the name of the command
remove several control points
virtual std::string getName() const
returns the name of the command
RemoveCtrlPointsCmd(HuginBase::Panorama &p, const HuginBase::UIntSet &points)
remove an image from a panorama
Definition PanoCommand.h:80
virtual std::string getName() const
returns the name of the command
Definition PanoCommand.h:87
RemoveImageCmd(HuginBase::Panorama &p, unsigned int imgNr)
Definition PanoCommand.h:82
remove multiple images from a panorama
Definition PanoCommand.h:95
virtual std::string getName() const
returns the name of the command
Definition PanoCommand.h:99
HuginBase::UIntSet imgNrs
RemoveImagesCmd(HuginBase::Panorama &p, HuginBase::UIntSet imgs)
Definition PanoCommand.h:97
reset output exposure to mean exposure of all images
ResetToMeanExposure(HuginBase::Panorama &p)
virtual std::string getName() const
returns the name of the command
Rotate the panorama.
RotatePanoCmd(HuginBase::Panorama &p, double yaw, double pitch, double roll)
virtual std::string getName() const
returns the name of the command
virtual std::string getName() const
returns the name of the command
SetActiveImagesCmd(HuginBase::Panorama &p, HuginBase::UIntSet &active)
set the panorama options
HuginBase::PanoramaOptions options
virtual std::string getName() const
returns the name of the command
SetPanoOptionsCmd(HuginBase::Panorama &p, const HuginBase::PanoramaOptions &opts)
update a single variable, possibly for a group of images
SetVariableCmd(HuginBase::Panorama &p, const HuginBase::UIntSet &images, const HuginBase::Variable &var)
HuginBase::Variable var
virtual std::string getName() const
returns the name of the command
HuginBase::UIntSet images
straighten panorama horizontically
virtual std::string getName() const
returns the name of the command
StraightenPanoCmd(HuginBase::Panorama &p)
virtual std::string getName() const
returns the name of the command
SwapImagesCmd(HuginBase::Panorama &p, unsigned int i1, unsigned int i2)
Translate the panorama.
TranslatePanoCmd(HuginBase::Panorama &p, double TrX, double TrY, double TrZ)
virtual std::string getName() const
returns the name of the command
update all control points
UpdateCPsCmd(HuginBase::Panorama &p, const HuginBase::CPVector &cps, bool doUpdateCPError=true)
virtual std::string getName() const
returns the name of the command
HuginBase::CPVector cps
Update the crop factor.
virtual std::string getName() const
returns the name of the command
UpdateCropFactorCmd(HuginBase::Panorama &p, HuginBase::UIntSet imgs, double newCropFactor)
Update the focal length.
virtual std::string getName() const
returns the name of the command
UpdateFocalLengthCmd(HuginBase::Panorama &p, HuginBase::UIntSet imgs, double newFocalLength)
update variables of a single image
UpdateImageVariablesCmd(HuginBase::Panorama &p, unsigned int ImgNr, const HuginBase::VariableMap &vars)
virtual std::string getName() const
returns the name of the command
update variables of a group of images
UpdateImagesVariablesCmd(HuginBase::Panorama &p, const HuginBase::UIntSet &change, const HuginBase::VariableMapVector &vars)
HuginBase::VariableMapVector vars
virtual std::string getName() const
returns the name of the command
update mask for given image
UpdateMaskForImgCmd(HuginBase::Panorama &p, unsigned int img, const HuginBase::MaskPolygonVector &mask)
virtual std::string getName() const
returns the name of the command
HuginBase::MaskPolygonVector m_mask
updates the optimize vector, aka all variables which should be optimized
HuginBase::OptimizeVector m_optvec
UpdateOptimizeVectorCmd(HuginBase::Panorama &p, HuginBase::OptimizeVector optvec)
virtual std::string getName() const
returns the name of the command
update the optimizer master switch
virtual std::string getName() const
returns the name of the command
UpdateOptimizerSwitchCmd(HuginBase::Panorama &p, int mode)
update the photometric optimizer master switch
UpdatePhotometricOptimizerSwitchCmd(HuginBase::Panorama &p, int mode)
virtual std::string getName() const
returns the name of the command
virtual std::string getName() const
returns the name of the command
UpdateSrcImageCmd(HuginBase::Panorama &p, unsigned i, HuginBase::SrcPanoImage img)
HuginBase::SrcPanoImage img
virtual std::string getName() const
returns the name of the command
UpdateSrcImagesCmd(HuginBase::Panorama &p, HuginBase::UIntSet i, std::vector< HuginBase::SrcPanoImage > imgs)
std::vector< HuginBase::SrcPanoImage > imgs
update variables by parsing a expression
UpdateVariablesByParseExpression(HuginBase::Panorama &p, const std::string &expression)
virtual std::string getName() const
returns the name of the command
update all variables & control points
HuginBase::VariableMapVector vars
UpdateVariablesCPCmd(HuginBase::Panorama &p, const HuginBase::VariableMapVector &vars, const HuginBase::CPVector &cps)
virtual std::string getName() const
returns the name of the command
update all variables & control points
UpdateVariablesCPSetCmd(HuginBase::Panorama &p, HuginBase::UIntSet imgs, const HuginBase::VariableMapVector &vars, const HuginBase::CPVector &cps)
virtual std::string getName() const
returns the name of the command
HuginBase::VariableMapVector vars
UpdateVariablesCmd(HuginBase::Panorama &p, const HuginBase::VariableMapVector &vars)
virtual std::string getName() const
returns the name of the command
HuginBase::VariableMapVector vars
update global white balance
virtual std::string getName() const
returns the name of the command
UpdateWhiteBalance(HuginBase::Panorama &p, double redFactor, double blueFactor)
#define WXIMPEX
This file specifies what image variables SrcPanoImg should have.
double Z
double X
double Y
std::vector< MaskPolygon > MaskPolygonVector
Definition Mask.h:150
std::vector< VariableMap > VariableMapVector
std::vector< ControlPoint > CPVector
std::vector< std::set< std::string > > OptimizeVector
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