39 for (std::vector<PanoCommand*>::iterator it =
commands.begin(); it !=
commands.end(); ++it)
48 for (std::vector<PanoCommand*>::iterator it =
commands.begin(); it !=
commands.end(); ++it)
50 result &= (**it).processPanorama(pano);
64 std::vector<HuginBase::SrcPanoImage>::const_iterator it;
65 for (it =
imgs.begin(); it !=
imgs.end(); ++it)
80 for (HuginBase::UIntSet::reverse_iterator it =
imgNrs.rbegin();
97 HuginBase::CPVector::const_iterator it;
99 for (it =
cps.begin(); it !=
cps.end(); ++it, i++)
135 HuginBase::UIntSet::iterator it;
136 HuginBase::VariableMapVector::const_iterator v_it =
vars.begin();
181 HuginBase::UIntSet::iterator it;
235 cpVector.push_back(point);
260 for (HuginBase::CPVector::iterator it =
cps.begin(); it !=
cps.end(); ++it)
262 if ((*it).image1Nr > (*it).image2Nr)
266 imgs.insert(it->image1Nr);
267 imgs.insert(it->image2Nr);
276 for (
auto it =
cps.begin(); it !=
cps.end(); ++it)
292 for (HuginBase::UIntSet::reverse_iterator it =
m_points.rbegin(); it !=
m_points.rend(); ++it)
310 HuginBase::UIntSet::iterator it;
354 for (HuginBase::UIntSet::iterator it =
imgNrs.begin(); it !=
imgNrs.end(); ++it)
371 :
PanoCommand(p), filename(filename), prefix(prefix)
414 for (HuginBase::UIntSet::const_iterator it =
imgNrs.begin(); it !=
imgNrs.end(); ++it)
416 allImgWithSameLens.insert(*it);
422 testedLens.insert(lensNr);
427 allImgWithSameLens.insert(i);
458 for (std::set<HuginBase::ImageVariableGroup::ImageVariableEnum>::iterator variableIt =
changeVariables.begin();
470 for (std::set<HuginBase::ImageVariableGroup::ImageVariableEnum>::iterator variableIt =
changeVariables.begin();
485 std::set<HuginBase::ImageVariableGroup::ImageVariableEnum>::iterator it;
494 #define image_variable( name, type, default_value )\
495 bool ChangeImage##name##Cmd::processPanorama(HuginBase::Panorama& pano)\
497 for (HuginBase::UIntSet::iterator it = image_numbers.begin(); it != image_numbers.end(); it++)\
499 HuginBase::SrcPanoImage img = pano.getSrcImage(*it);\
500 img.set##name(value);\
501 pano.setSrcImage(*it, img);\
506 #undef image_variable
513 for (std::set<HuginBase::ImageVariableGroup::ImageVariableEnum>::iterator it =
vars.begin(); it !=
vars.end(); ++it)
517 #define image_variable( name, type, default_value )\
518 case HuginBase::ImageVariableGroup::IVE_##name:\
519 pano.unlinkImageVariable##name(image_index);\
522 #undef image_variable
530 std::size_t part_number = group.getPartNumber(image_index);
531 group.switchParts(*it, part_number);
562 const double hfov = img.getHFOV();
568 imgsPerRow =
std::max(3,
int(360 / (0.8*hfov)));
569 imgsPerRow =
std::min(imgsPerRow, nrImages);
574 imgsPerRow = nrImages;
576 double offset = 0.75*hfov;
577 if ((imgsPerRow - 1.0)*offset>360)
579 offset = 360 / (imgsPerRow - 1.0);
581 double yaw = -(imgsPerRow - 1.0) / 2.0*offset;
583 if (imgsPerRow<nrImages)
585 pitch = (-(std::ceil(
double(nrImages) /
double(imgsPerRow)) - 1.0) / 2.0*offset);
589 for (
size_t i = 0; i<nrImages; i++)
591 HuginBase::VariableMap::iterator it = varsVec[i].find(
"y");
592 if (it != varsVec[i].end())
594 it->second.setValue(yaw);
596 it = varsVec[i].find(
"p");
597 if (it != varsVec[i].end())
599 it->second.setValue(pitch);
603 if (counter == imgsPerRow)
607 yaw = -(imgsPerRow - 1.0) / 2.0*offset;
virtual bool processPanorama(HuginBase::Panorama &pano)
Called by execute().
HuginBase::VariableMap vars
Base class for all panorama commands.
virtual bool processPanorama(HuginBase::Panorama &pano)
Called by execute().
void linkVariableImage(ImageVariableEnum variable, unsigned int imageNr)
link one of the variables across a part containing a given image
virtual bool processPanorama(HuginBase::Panorama &pano)
Called by execute().
HuginBase::PanoramaOptions options
HuginBase::UIntSet image_numbers
HuginBase::VariableMapVector vars
virtual bool processPanorama(HuginBase::Panorama &pano)
Called by execute().
std::set< HuginBase::ImageVariableGroup::ImageVariableEnum > variables
virtual bool processPanorama(HuginBase::Panorama &pano)
Called by execute().
void setHeight(unsigned int h)
set panorama height
virtual bool processPanorama(HuginBase::Panorama &pano)
Called by execute().
unsigned int getPartNumber(unsigned int imageNr) const
Get a part number from an image number.
void moveImage(size_t img1, size_t img2)
moves images.
static double calcMeanExposure(const PanoramaData &pano)
HuginBase::SrcPanoImage img
HuginBase::UIntSet images
virtual bool processPanorama(HuginBase::Panorama &pano)
Called by execute().
virtual bool processPanorama(HuginBase::Panorama &pano)
Called by execute().
void updateCtrlPointErrors(const CPVector &controlPoints)
update control points distances.
virtual bool processPanorama(HuginBase::Panorama &pano)
Called by execute().
HuginBase::VariableMapVector vars
virtual bool processPanorama(HuginBase::Panorama &pano)
Called by execute().
HuginBase::OptimizeVector m_optvec
virtual bool processPanorama(HuginBase::Panorama &pano)
Called by execute().
virtual void updateWhiteBalance(double redFactor, double blueFactor)
update the global white balace of the panorama by multiplying the red and blue factor of each image w...
virtual bool processPanorama(HuginBase::Panorama &pano)
Called by execute().
void setPhotometricOptimizerSwitch(const int newSwitch)
sets the photometric optimizer master switch
HuginBase::VariableMapVector vars
HuginBase::UIntSet m_active
virtual bool processPanorama(HuginBase::Panorama &pano)
Called by execute().
virtual bool processPanorama(HuginBase::Panorama &pano)
Called by execute().
virtual bool processPanorama(HuginBase::Panorama &pano)
Called by execute().
HuginBase::UIntSet image_numbers
void swapImages(unsigned int img1, unsigned int img2)
swap images.
virtual bool processPanorama(HuginBase::Panorama &pano)
Called by execute().
bool set_contains(const _Container &c, const typename _Container::key_type &key)
HuginBase::UIntSet imgNrs
#define DEBUG_ASSERT(cond)
std::vector< PanoCommand * > commands
virtual bool processPanorama(HuginBase::Panorama &pano)
Called by execute().
HuginBase::UIntSet change
HuginBase::MaskPolygonVector m_mask
HuginBase::UIntSet m_imgs
virtual void run()
runs the algorithm.
virtual bool processPanorama(HuginBase::Panorama &pano)
Called by execute().
HuginBase::UIntSet imgNrs
Panorama getSubset(const UIntSet &imgs) const
get a subset of the panorama
const std::string & filename
void setOptimizerSwitch(const int newSwitch)
set optimizer master switch
represents a control point
virtual void updateVariables(const VariableMapVector &vars)
Set the variables.
void setOptimizeVector(const OptimizeVector &optvec)
set optimize setting
void linkVariablePart(ImageVariableEnum variable, unsigned int partNr)
link one of the variables across a given part
HuginBase::UIntSet imgNrs
virtual bool processPanorama(HuginBase::Panorama &pano)
Called by execute().
void UpdateSingleCtrlPointError(const HuginBase::Panorama &pano, HuginBase::ControlPoint &point)
Panorama duplicate() const
duplicate the panorama
virtual bool processPanorama(HuginBase::Panorama &pano)
Called by execute().
std::set< unsigned int > UIntSet
IMPEX void PanoParseExpression(HuginBase::Panorama &pano, const std::string &expression, std::ostream &statusStream=std::cout, std::ostream &errorStream=std::cerr)
parses the given expression and apply the changes to the Panorama
virtual void UpdateCropFactor(UIntSet imgs, double newCropFactor)
updates the crop factor, try to keep focal length constant
std::vector< VariableMap > VariableMapVector
virtual bool processPanorama(HuginBase::Panorama &pano)
Called by execute().
virtual bool processPanorama(HuginBase::Panorama &pano)
Called by execute().
virtual bool processPanorama(HuginBase::Panorama &pano)
Called by execute().
unsigned int addCtrlPoint(const ControlPoint &point)
add a new control point.
std::set< HuginBase::ImageVariableGroup::ImageVariableEnum > changeVariables
virtual bool processPanorama(HuginBase::Panorama &pano)
Called by execute().
std::set< HuginBase::ImageVariableGroup::ImageVariableEnum > vars
VariableMapVector getVariables() const
get variables of this panorama
std::size_t getNrOfImages() const
number of images.
void setCtrlPoints(const CPVector &points)
set all control points (Ippei: Is this supposed to be 'add' method?)
virtual bool processPanorama(HuginBase::Panorama &pano)
Called by execute().
const ControlPoint & getCtrlPoint(std::size_t nr) const
get a control point, counting starts with 0
void changeControlPoint(unsigned int pNr, const ControlPoint &point)
change a control Point.
bool ReadPTOFile(const std::string &filename, const std::string &prefix="")
read pto file from the given filename into Panorama object it does some checks on the file and issues...
virtual double getResultHeight()
ImageVariableGroup & getLenses()
Get the ImageVariableGroup representing the group of lens variables.
void activateImage(unsigned int imgNr, bool active=true)
mark an image as active or inactive.
virtual bool processPanorama(HuginBase::Panorama &pano)
Called by execute().
virtual bool processPanorama(HuginBase::Panorama &pano)
Called by execute().
virtual bool processPanorama(HuginBase::Panorama &pano)
Called by execute().
LoadPTProjectCmd(HuginBase::Panorama &p, const std::string &filename, const std::string &prefix="")
void removeImage(unsigned int nr)
creates an image, from filename, and a Lens, if needed
HuginBase::Panorama newPano
HuginBase::UIntSet image_numbers
unsigned int addImage(const SrcPanoImage &img)
the the number for a specific image
HuginBase::UIntSet m_points
virtual bool processPanorama(HuginBase::Panorama &pano)
Called by execute().
virtual bool processPanorama(HuginBase::Panorama &pano)
Called by execute().
virtual bool processPanorama(HuginBase::Panorama &pano)
Called by execute().
Same as above, but use a non const panorama.
virtual bool processPanorama(HuginBase::Panorama &pano)
Called by execute().
virtual bool processPanorama(HuginBase::Panorama &pano)
Called by execute().
void setHFOV(double h, bool keepView=true)
set the horizontal field of view.
virtual bool processPanorama(HuginBase::Panorama &pano)
Called by execute().
virtual bool processPanorama(HuginBase::Panorama &pano)
Called by execute().
void unlinkVariableImage(ImageVariableEnum variable, unsigned int imageNr)
unlink one the variables across the part containing a given image.
const PanoramaOptions & getOptions() const
returns the options for this panorama
virtual double getResultHorizontalFOV()
std::size_t new_part_number
HuginBase::UIntSet imgNrs
void markAsOptimized(bool optimized=true)
void updatePartNumbers()
Update the part numbers, call this when the panorama changes.
HuginBase::ControlPoint point
virtual bool processPanorama(HuginBase::Panorama &pano)
Called by execute().
void removeCtrlPoint(unsigned int pNr)
remove a control point.
std::vector< ControlPoint > CPVector
HuginBase::VariableMapVector vars
virtual bool processPanorama(HuginBase::Panorama &pano)
Called by execute().
HuginBase::ControlPoint point
const SrcPanoImage & getImage(std::size_t nr) const
get a panorama image, counting starts with 0
std::vector< HuginBase::SrcPanoImage > imgs
void setOptions(const PanoramaOptions &opt)
set new output settings This is not used directly for optimizing/stiching, but it can be feed into ru...
void setSrcImage(unsigned int nr, const SrcPanoImage &img)
set input image parameters
void updateMasksForImage(unsigned int imgNr, MaskPolygonVector newMasks)
set complete mask list for image with number
virtual bool processPanorama(HuginBase::Panorama &pano)
Called by execute().
virtual bool processPanorama(HuginBase::Panorama &pano)
Called by execute().
std::set< HuginBase::ImageVariableGroup::ImageVariableEnum > groupVariables
All variables of a source image.
virtual bool processPanorama(HuginBase::Panorama &pano)
Called by execute().
virtual void updateVariable(unsigned int imgNr, const Variable &var)
update a single variable
void switchParts(unsigned int ImageNr, unsigned int partNr)
switch a given image to a different part number.
virtual bool processPanorama(HuginBase::Panorama &pano)
Called by execute().
This file specifies what image variables SrcPanoImg should have.
virtual bool processPanorama(HuginBase::Panorama &pano)
Called by execute().
void reset()
clear the internal state.
function to parse expressions from strings
void mirror()
swap (image1Nr,x1,y1) with (image2Nr,x2,y2)
std::vector< HuginBase::SrcPanoImage > imgs
void mergePanorama(const Panorama &newPano)
merges the panorama with the given pano
std::set< HuginBase::ImageVariableGroup::ImageVariableEnum > variables
double outputExposureValue
virtual bool processPanorama(HuginBase::Panorama &pano)
Called by execute().
virtual void UpdateFocalLength(UIntSet imgs, double newFocalLength)
updates the focal length by changing hfov