85 std::vector<unsigned int> result;
88 if ((
it->image1Nr == imgNr) || (
it->image2Nr == imgNr)) {
104 result.push_back(std::make_pair(
i,point));
111 result.push_back(std::make_pair(
i,point));
151 for (CPVector::const_iterator
it = cps.begin();
it != cps.end(); ++
it) {
163 unsigned int nrp = cps.size();
164 for (
unsigned int i = 0;
i <
nrp ;
i++) {
175 for (VariableMapVector::const_iterator
it = vars.begin();
it != vars.end(); ++
it) {
183 VariableMapVector::const_iterator
v_it = vars.begin();
184 for (UIntSet::const_iterator
it = imgs.begin();
it != imgs.end(); ++
it) {
195 for (VariableMap::const_iterator
it = var.begin();
it != var.end() ; ++
it) {
207#define image_variable( name, type, default_value ) \
208 if (PTOVariableConverterFor##name::checkApplicability(var.getName())) \
210 for (std::size_t i = 0; i < getNrOfImages(); i++)\
212 if (state.images[imgNr]->name##isLinkedWith(*state.images[i]))\
229 for(UIntSet::const_iterator
it=imgs.begin();
it!=imgs.end();++
it)
235 for(UIntSet::const_iterator
it=imgs.begin();
it!=imgs.end();++
it)
263 for(UIntSet::const_iterator
it=imgs.begin();
it!=imgs.end();++
it)
275#define image_variable( name, type, default_value )\
276void Panorama::linkImageVariable##name(unsigned int sourceImgNr, unsigned int destImgNr)\
278 state.images[destImgNr]->link##name(state.images[sourceImgNr]);\
279 imageChanged(destImgNr);\
280 imageChanged(sourceImgNr);\
281 state.needsOptimization = true;\
287#define image_variable( name, type, default_value )\
288void Panorama::unlinkImageVariable##name(unsigned int imgNr)\
290 state.images[imgNr]->unlink##name();\
291 imageChanged(imgNr);\
292 state.needsOptimization = true;\
331 DEBUG_DEBUG(
"Panorama::removeImage(" << imgNr <<
")");
337 if ((
it->image1Nr == imgNr) || (
it->image2Nr == imgNr)) {
342 if (
it->image1Nr > imgNr)
it->image1Nr--;
343 if (
it->image2Nr > imgNr)
it->image2Nr--;
348 DEBUG_TRACE(
"Remove variables and image from panorama state")
413 std::pair<std::set<std::string>::iterator,
bool>
it=
listOfCPs.insert(
s);
474 std::map<int, int>
lines;
482 for (std::map<int,int >::iterator
it =
lines.begin();
it !=
lines.end(); ++
it)
515 o <<
"# PTOptimizer script, written by hugin" << std::endl
518 o <<
"# hugin project file" << std::endl;
519 o <<
"#hugin_ptoversion 2" << std::endl;
526 std::map<unsigned int, unsigned int>
imageNrMap;
528 <<
"# image lines" << std::endl;
534 for (UIntSet::const_iterator
imgNrIt = imgs.begin();
imgNrIt != imgs.end();
545 if (img.getAutoCenterCrop())
546 o <<
" autoCenterCrop=1";
548 o <<
" cropFactor=" << img.getCropFactor() ;
549 if (! img.getActive()) {
554 o <<
"i w" << img.getSize().width() <<
" h" << img.getSize().height()
555 <<
" f" << img.getProjection() <<
" ";
567#define image_variable( name, type, default_value )\
568 PTOVariableConverterFor##name::addToVariableMap(state.images[imgNr]->get##name##IV(), vars);\
571 bool linking = false;\
572 std::size_t link_target;\
575 if (state.images[imgNr]->name##isLinked())\
577 for (link_target = 0; link_target < imgNr; link_target++)\
579 if (set_contains(imgs,link_target) && state.images[imgNr]->name##isLinkedWith(*state.images[link_target]))\
587 for (VariableMap::const_iterator vit = vars.begin();\
588 vit != vars.end(); ++vit)\
590 if (forPTOptimizer && !set_contains(m_ptoptimizerVarNames,vit->first))\
594 o << vit->first << "=" << imageNrMap[link_target] << " ";\
596 if (set_contains(optvars[imgNr], vit->first))\
598 vlines << "v " << vit->first << imageNrMap[imgNr] << std::endl;\
600 if (((vit->first == "a" && set_contains(optvars[imgNr], "a") )|| \
601 (vit->first == "b" && set_contains(optvars[imgNr], "b") )|| \
602 (vit->first == "c" && set_contains(optvars[imgNr], "c") )|| \
603 (vit->first == "TrX" && set_contains(optvars[imgNr], "TrX") )|| \
604 (vit->first == "TrY" && set_contains(optvars[imgNr], "TrY") )|| \
605 (vit->first == "TrZ" && set_contains(optvars[imgNr], "TrZ") )\
607 && forPTOptimizer && vit->second.getValue() == 0.0) \
609 o << vit->first << 1e-5 << " ";\
610 } else if (( (vit->first == "r" && set_contains(optvars[imgNr], "r") ) || \
611 (vit->first == "p" && set_contains(optvars[imgNr], "p") ) || \
612 (vit->first == "y" && set_contains(optvars[imgNr], "y") ) \
614 && forPTOptimizer && fabs(vit->second.getValue()) < 1e-13)\
616 o << vit->first << 0 << " ";\
618 vit->second.print(o) << " ";\
629 vigra::Rect2D c = img.getCropRect();
630 o <<
" S" << c.left() <<
"," << c.right() <<
"," << c.top() <<
"," << c.bottom();
636 o <<
" Vm" << img.getVigCorrMode();
639 if (!img.getFlatfieldFilename().empty()) {
640 o <<
" Vf\"" << img.getFlatfieldFilename() <<
"\"";
642 if (img.getResponseType() > 0) {
643 o <<
" Rt" << img.getResponseType();
652 o <<
" u" <<
output.featherWidth
653 << (img.getMorph() ?
" o" :
"");
655 std::string
fname = img.getFilename();
668 o <<
" n\"" <<
fname <<
"\"" << std::endl;
672 o << std::endl << std::endl
673 <<
"# specify variables that should be optimized" << std::endl
677 o << std::endl << std::endl
678 <<
"# control points" << std::endl;
683 <<
" x" <<
it->x1 <<
" y" <<
it->y1
684 <<
" X" <<
it->x2 <<
" Y" <<
it->y2
685 <<
" t" <<
it->mode << std::endl;
691 o <<
"# masks" << std::endl
696 o <<
"#hugin_optimizeReferenceImage " <<
output.optimizeReferenceImage << std::endl;
697 o <<
"#hugin_blender ";
698 switch (
output.blendMode) {
703 o <<
"PTblender" << endl;
706 o <<
"smartblend" << endl;
709 o <<
"PTmasker" << endl;
712 o <<
"internal" << endl;
716 o <<
"enblend" << endl;
720 o <<
"#hugin_remapper ";
721 switch (
output.remapper) {
723 o <<
"PTmender" << endl;
731 o <<
"#hugin_enblendOptions " <<
output.enblendOptions << endl;
732 o <<
"#hugin_enfuseOptions " <<
output.enfuseOptions << endl;
733 o <<
"#hugin_hdrmergeOptions " <<
output.hdrmergeOptions << endl;
734 o <<
"#hugin_verdandiOptions " <<
output.verdandiOptions << endl;
735 o <<
"#hugin_edgeFillMode " <<
static_cast<int>(
output.edgeFillMode) << endl;
736 o <<
"#hugin_edgeFillKeepInput " << (
output.keepEdgeFillInput ?
"true" :
"false") << endl;
738 o <<
"#hugin_outputLDRBlended " << (
output.outputLDRBlended ?
"true" :
"false") << endl;
739 o <<
"#hugin_outputLDRLayers " << (
output.outputLDRLayers ?
"true" :
"false") << endl;
740 o <<
"#hugin_outputLDRExposureRemapped " << (
output.outputLDRExposureRemapped ?
"true" :
"false") << endl;
741 o <<
"#hugin_outputLDRExposureLayers " << (
output.outputLDRExposureLayers ?
"true" :
"false") << endl;
742 o <<
"#hugin_outputLDRExposureBlended " << (
output.outputLDRExposureBlended ?
"true" :
"false") << endl;
743 o <<
"#hugin_outputLDRStacks " << (
output.outputLDRStacks ?
"true" :
"false") << endl;
744 o <<
"#hugin_outputLDRExposureLayersFused " << (
output.outputLDRExposureLayersFused ?
"true" :
"false") << endl;
745 o <<
"#hugin_outputHDRBlended " << (
output.outputHDRBlended ?
"true" :
"false") << endl;
746 o <<
"#hugin_outputHDRLayers " << (
output.outputHDRLayers ?
"true" :
"false") << endl;
747 o <<
"#hugin_outputHDRStacks " << (
output.outputHDRStacks ?
"true" :
"false") << endl;
749 o <<
"#hugin_outputLayersCompression " <<
output.outputLayersCompression << endl;
750 o <<
"#hugin_outputImageType " <<
output.outputImageType << endl;
751 o <<
"#hugin_outputImageTypeCompression " <<
output.outputImageTypeCompression << endl;
752 o <<
"#hugin_outputJPEGQuality " <<
output.quality << endl;
753 o <<
"#hugin_outputImageTypeHDR " <<
output.outputImageTypeHDR << endl;
754 o <<
"#hugin_outputImageTypeHDRCompression " <<
output.outputImageTypeHDRCompression << endl;
756 o <<
"#hugin_outputStacksMinOverlap " << std::setprecision(3) <<
output.outputStacksMinOverlap << endl;
757 o <<
"#hugin_outputLayersExposureDiff " << std::setprecision(2) <<
output.outputLayersExposureDiff << endl;
759 o <<
"#hugin_outputRangeCompression " << std::setprecision(2) <<
output.outputRangeCompression << endl;
768 o <<
"#hugin_optimizerMasterSwitch 0" << endl;
769 o <<
"#hugin_optimizerPhotoMasterSwitch 0" << endl;
786 o <<
"# PTStitcher script, written by hugin" << std::endl
791 <<
"# output image lines" << std::endl;
799 o <<
"o w" << img.getSize().width() <<
" h" << img.getSize().height()
800 <<
" f" << img.getProjection() <<
" ";
802 VariableMap::const_iterator
vit;
803 for(
vit = vars.begin();
vit != vars.end(); ++
vit)
808 vit->second.print(o) <<
" ";
812 o <<
" u" << img.getFeatureWidth()
813 << (img.getMorph() ?
" o" :
"");
815 o <<
" n\"" << img.getFilename() <<
"\"";
818 vigra::Rect2D c = img.getCropRect();
819 o <<
" S" << c.left() <<
"," << c.right() <<
"," << c.top() <<
"," << c.bottom();
836 DEBUG_DEBUG(
"forcing images update, with no images");
845 std::ostream_iterator<unsigned int>(
t,
" "));
846 DEBUG_TRACE(
"changed image(s) " <<
t.str() <<
" begin");
864 std::list<PanoramaObserver *>::iterator
it;
870 (*it)->panoramaChanged(*
this);
1010 for(
unsigned int j=0;
j<masks.size();
j++)
1017 switch(masks[
j].getMaskType())
1021 masks[
j].setImgNr(
i);
1040 masks[
j].setImgNr(
i);
1054 masks[
j].setImgNr(
k);
1065 switch(masks[
j].getMaskType())
1069 masks[
j].setImgNr(
i);
1095 masks[
j].setImgNr(
i);
1133 masks[
j].setImgNr(
k);
1149 vigra::Rect2D r=
state.
images[imgNr]->getCropRect();
1150 if(r.isEmpty() || r==vigra::Rect2D(
state.
images[imgNr]->getSize()))
1176 vigra::Point2D center = vigra::Point2D(
state.
images[imgNr]->getSize().width()/2 + dx,
state.
images[imgNr]->getSize().height()/2 + dy);
1178 vigra::Diff2D
d(
state.
images[imgNr]->getCropRect().width() / 2,
state.
images[imgNr]->getCropRect().height() / 2);
1246 if (refImage.YawisLinkedWith(
compImage))
1261 for (CPVector::const_iterator
it = cps.begin();
it != cps.end(); ++
it)
1382 DEBUG_TRACE(
"swapping images " << img1 <<
", " << img2);
1393 int n1 = (*it).image1Nr;
1394 int n2 = (*it).image2Nr;
1395 if ((*it).image1Nr == img1) {
1397 }
else if ((*it).image1Nr == img2) {
1400 if ((*it).image2Nr == img1) {
1402 }
else if ((*it).image2Nr == img2) {
1405 (*it).image1Nr =
n1;
1406 (*it).image2Nr =
n2;
1442 std::map<size_t,size_t>
imgMap;
1470 (*it).image1Nr =
imgMap[(*it).image1Nr];
1471 (*it).image2Nr =
imgMap[(*it).image2Nr];
1473 if ((*it).image1Nr > (*it).image2Nr)
1495 }
catch (std::bad_cast&) {
1634 #define image_variable( name, type, default_value ) \
1635 dest->set##name (img.get##name());
1637 #undef image_variable
1640#define image_variable( name, type, default_value ) \
1641 for (std::size_t i = 0; i < getNrOfImages(); i++)\
1643 if(state.images[imgNr]->name##isLinkedWith(*state.images[i]))\
1649#undef image_variable
1669 subset.state.optSwitch=0;
1670 subset.state.optPhotoSwitch=0;
1693 for (
auto&
j : imgs)
1695#define image_variable(name, type, default_value)\
1696 if (PTOVariableConverterFor##name::checkApplicability(var))\
1698 if (state.images[i]->name##isLinkedWith(*state.images[j]))\
1700 internalOptvec[j].insert(var);\
1705#undef image_variable
1712 std::map<unsigned int, unsigned int>
imageNrMap;
1715 unsigned int ic = 0;
1716 for (UIntSet::const_iterator
imgNrIt = imgs.begin();
imgNrIt != imgs.end();
1727 for (UIntSet::const_iterator
i = imgs.begin();
i != imgs.end(); ++
i)
1729 unsigned int jc =
ic + 1;
1730 UIntSet::const_iterator
j =
i;
1731 for (++
j;
j != imgs.end(); ++
j)
1737#define image_variable( name, type, default_value )\
1738 if (state.images[*i]->name##isLinkedWith(*state.images[*j]))\
1740 subset.state.images[ic]->link##name(subset.state.images[jc]);\
1743#undef image_variable
1750 subset.state.ctrlPoints.clear();
1808 if (img1.YawisLinked())
1838 for (CPVector::const_iterator
it = cps.begin();
it != cps.end(); ++
it)
1870 std::string filename=newPano.
getImage(
i).getFilename();
1955 compareImage.getExifModel() == srcImage.getExifModel() &&
1956 compareImage.getExifMake() == srcImage.getExifMake() &&
1957 compareImage.getExifFocalLength() == srcImage.getExifFocalLength())
1979#define image_variable( name, type, default_value )\
1980 if(img.name##isLinkedWith(newPano.getImage(j)))\
1982 linkImageVariable##name(new_image_nr[i],new_image_nr[j]);\
1985#undef image_variable
1991 for(
unsigned int i=0;
i<cps.size();
i++)
1994 if (cps[
i].mode > 2)
2015 t = std::max(
t,
it->mode);
2026 if (vigra::isImage(filename.c_str()))
2028 std::cerr <<
"file \"" << filename <<
"\" seems to be an image file and not a PTO file." << std::endl;
2032 std::ifstream
dataInput(filename.c_str());
2035 std::cerr <<
"could not open script : " << filename << std::endl;
2054 std::cerr <<
"error while parsing panos tool script: " << filename << std::endl;
2061 std::ofstream
outputStream(filename, std::ofstream::out | std::ofstream::trunc);
2073 catch (std::exception& e)
2077 std::cerr <<
"Failed to write project file " << filename <<
" (error: " << e.what() <<
")" << std::endl;
2085 std::cerr <<
"Failed to write project file " << filename <<
" (Can not create file.)" << std::endl;
2126 double minEv = 1000;
2127 double maxEv = -1000;
2189 for (
size_t imgNr = 0; imgNr <
state.
images.size(); imgNr++)
2215 unsigned int imgNr = 0;
2260 for (std::vector<SrcPanoImage *>::const_iterator
it = data.
images.begin();
2280#define image_variable( name, type, default_value )\
2281 if (data.images[i]->name##isLinkedWith(*data.images[j]))\
2283 images[i]->link##name(images[j]);\
2286#undef image_variable
2313 for (std::vector<SrcPanoImage *>::iterator
it =
images.begin();
2331 const std::string
controlCharacters { 0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 11, 12, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31};
2334 std::vector<PTScriptParsing::ImgInfo>
oImgInfo;
2335 std::vector<PTScriptParsing::ImgInfo>
iImgInfo;
2337 std::vector<PTScriptParsing::ImgInfo>
cImgInfo;
2365 std::getline(
i, line);
2415 int left, right, top, bottom;
2416 int n =
sscanf(
format.c_str(),
"%d,%d,%d,%d", &left, &right, &top, &bottom);
2480 if (
comp ==
"NONE" ||
comp ==
"LZW" ||
2481 comp ==
"PACKBITS" ||
comp ==
"DEFLATE")
2485 DEBUG_WARN(
"No valid tiff compression found");
2490 if (
comp ==
"CROP") {
2534 if (var.length() == 1) {
2539 std::string::size_type
np = var.find_first_of(
"0123456789");
2540 if (
np == std::string::npos) {
2544 std::string name=var.substr(0,
np);
2555 DEBUG_DEBUG(
"parsing opt: >" << var <<
"< : var:" << name <<
" image:" <<
nr);
2633 if (line.substr(0,20) == std::string(
"# ptGui project file")) {
2636 if (line.substr(0,12) ==
"#-dummyimage") {
2668 if (line.substr(0,8) ==
"#-hugin ") {
2671 info.
autoCenterCrop = (line.find(
"autoCenterCrop=1") != std::string::npos);
2672 size_t pos = line.find(
"cropFactor=");
2673 if (
pos > 0 &&
pos < line.length()) {
2674 double cropFactor=1;
2675 const char *
s = line.c_str() +
pos;
2676 sscanf(
s,
"cropFactor=%lf", & cropFactor);
2681 pos = line.find(
"disabled");
2682 if (
pos > 0 &&
pos < line.length()) {
2690 if (line.substr(0,10) ==
"#-imgfile ") {
2693 int b = line.find_first_not_of(
" ",9);
2694 int e = line.find_first_of(
" ",b);
2695 DEBUG_DEBUG(
" width:" << line.substr(b, e - b) <<
":")
2702 b = line.find_first_not_of(
" ",e);
2703 e = line.find_first_of(
" ",b);
2704 DEBUG_DEBUG(
" height:" << line.substr(b, e - b) <<
":")
2714 b = line.find_first_not_of(
" \"",e);
2715 e = line.find_first_of(
"\"",b);
2717 }
catch (std::out_of_range& e) {
2718 DEBUG_ERROR(
"ERROR PARSING INPUT FILE" << e.what( ));
2732 if (line.substr(0,7) ==
"#hugin_") {
2733 std::istringstream
is(line);
2734 std::string var,value;
2737 if (var ==
"#hugin_ptoversion") {
2741 if (var ==
"#hugin_optimizeReferenceImage") {
2743 }
else if (var ==
"#hugin_remapper") {
2744 if (value ==
"nona") {
2746 }
else if (value ==
"PTmender") {
2749 }
else if (var ==
"#hugin_blender") {
2750 if (value ==
"none") {
2752 }
else if (value ==
"PTblender") {
2754 }
else if (value ==
"enblend") {
2756 }
else if (value ==
"PTmasker") {
2758 }
else if (value ==
"smartblend") {
2760 }
else if (value ==
"internal") {
2764 }
else if (var ==
"#hugin_enblendOptions") {
2768 if (!
is.fail() && value.length() > 0) {
2773 }
else if (var ==
"#hugin_enfuseOptions") {
2777 if (!
is.fail() && value.length() > 0) {
2782 }
else if (var ==
"#hugin_hdrmergeOptions") {
2786 if (!
is.fail() && value.length() > 0) {
2791 }
else if (var ==
"#hugin_verdandiOptions") {
2795 if (!
is.fail() && value.length() > 0) {
2800 }
else if (var ==
"#hugin_edgeFillMode") {
2812 }
else if (var ==
"#hugin_edgeFillKeepInput") {
2814 }
else if (var ==
"#hugin_outputLDRBlended") {
2816 }
else if (var ==
"#hugin_outputLDRLayers") {
2818 }
else if (var ==
"#hugin_outputLDRExposureRemapped") {
2820 }
else if (var ==
"#hugin_outputLDRExposureLayers") {
2822 }
else if (var ==
"#hugin_outputLDRExposureBlended") {
2824 }
else if (var ==
"#hugin_outputLDRExposureLayersFused") {
2826 }
else if (var ==
"#hugin_outputLDRStacks") {
2828 }
else if (var ==
"#hugin_outputHDRBlended") {
2830 }
else if (var ==
"#hugin_outputHDRLayers") {
2832 }
else if (var ==
"#hugin_outputHDRStacks") {
2835 }
else if (var ==
"#hugin_outputStacksMinOverlap") {
2836 double val=
atof(value.c_str());
2837 if(val>0 && val <= 1)
2845 }
else if (var ==
"#hugin_outputLayersExposureDiff") {
2846 double val=
atof(value.c_str());
2852 }
else if (var ==
"#hugin_outputLayersCompression") {
2854 }
else if (var ==
"#hugin_outputImageType") {
2856 }
else if (var ==
"#hugin_outputImageTypeCompression") {
2858 }
else if (var ==
"#hugin_outputJPEGQuality") {
2860 }
else if (var ==
"#hugin_outputImageTypeHDR") {
2862 }
else if (var ==
"#hugin_outputImageTypeHDRCompression") {
2864 }
else if (var ==
"#hugin_outputRangeCompression") {
2867 }
else if (var ==
"#hugin_optimizerMasterSwitch") {
2869 }
else if (var ==
"#hugin_optimizerPhotoMasterSwitch") {
3008 std::string name(*
v);
3010 map_get(vars,name).setValue(val);
3016 std::string file =
iImgInfo[
i].filename;
3019 bool absPath = ( (file[1]==
':' && file[2]==
'\\') || (file[1]==
':' && file[2]==
'/') || (file[0] ==
'\\' && file[1] ==
'\\'));
3021 bool absPath = file[0] ==
'/';
3024 file.insert(0, prefix);
3035 new_img.checkImageSizeKnown();
3063#define RESET_LOCALE setlocale(LC_NUMERIC,old_locale); free(old_locale);
3064#define image_variable( name, type, default_value )\
3065 PTOVariableConverterFor##name::addToVariableMap(name_src.get##name##IV(), vars_for_name);\
3066 for (VariableMap::iterator vit = vars_for_name.begin();\
3067 vit != vars_for_name.end(); vit++)\
3069 if (link >= 0 && iImgInfo[i].links[vit->first] >= 0)\
3071 if ( !(PTGUILensLoaded && link == 0)\
3072 && (int) images.size() < link && (!PTGUILensLoaded))\
3074 DEBUG_ERROR("variables must be linked to an image with a lower number" << endl\
3075 << "number links: " << link << " images: " << images.size() << endl\
3076 << "error on line " << lineNr << ":" << endl\
3081 DEBUG_DEBUG("anchored to image " << iImgInfo[i].links[vit->first]);\
3082 new_img.link##name(images[iImgInfo[i].links[vit->first]]);\
3084 double val = map_get(vars, vit->first).getValue();\
3085 new_img.setVar(vit->first, val);\
3088 vars_for_name.clear();
3090#undef image_variable
3094#define check_stack_link(name) \
3095 if(!new_img.YawisLinked() && new_img.name##isLinked())\
3097 new_img.unlink##name();\
3099 if(new_img.YawisLinked() && !new_img.name##isLinked())\
3101 for(size_t j=0; j<i; j++)\
3103 if(new_img.YawisLinkedWith(*images[j]))\
3105 new_img.link##name(images[j]);\
3117#undef check_stack_link
3164 if (
cp.image1Nr >
cp.image2Nr)
3176 std::cout <<
"WARNING: Project file contains control points that are connected with" << std::endl
3177 <<
" non existing images. Ignoring these control points." << std::endl;
3183 std::cerr <<
"ERROR: Project file contains no images." << std::endl;
3191 std::cout <<
"WARNING: Optimize reference image refers to non existing image. Reset to default value." << std::endl;
3197 std::cout <<
"WARNING: Optimize photometric reference image refers to non existing image. Reset to default value." << std::endl;
definitions of classes to calculate overlap between different images
Convenience functions for SrcPanoImage to use on the image variables.
declaration of functions to handle stacks and layers
some definitions to work with optimizer master switches
#define check_stack_link(name)
Somewhere to specify what variables belong to what.
virtual void setDirty(const bool &dirty=true)
@ VIGCORR_NONE
no vignetting correction
@ RESPONSE_EMOR
empirical model of response
class for calculating overlap of images
An ImageVariableGroup is a collection of image variables that can have some shared variable values.
Make an ImageVariableGroup for lenses and other common concepts.
static const std::set< ConstImageVariableGroup::ImageVariableEnum > & getLensVariables()
Get the set of lens image variables.
represents a control point
void mirror()
swap (image1Nr,x1,y1) with (image2Nr,x2,y2)
@ X
evaluate x, points are on a vertical line
@ Y
evaluate y, points are on a horizontal line
Same as above, but use a non const panorama.
void setImageSize(const vigra::Size2D &sz)
set image size in pixels
void setProjection(LensProjectionFormat l)
set projection type
void setCropFactor(double newCropFactor)
sets the crop factor
static const char * variableNames[]
base class, which stores one mask polygon
bool isPositive() const
returns true, if mask type is positive
void setImgNr(const unsigned int newImgNr)
sets the associated image number, only used when loading a project, otherwise discarded
MaskType
enumeration with type of possible masks
Memento class for a PanoramaData object.
Memento class for a Panorama object.
std::vector< SrcPanoImage * > images
The images inside the panorama.
std::string iccProfileDesc
description of the icc profile
bool loadPTScript(std::istream &i, int &ptoVersion, const std::string &prefix="")
load a Hugin file
int bands
number of bands of first image (without alpha channel), currently we can't mix grayscale and RGB imag...
int optSwitch
stores the optimizer switch, use OR of HuginBase::OptimizerSwitches
PanoramaMemento & operator=(const PanoramaMemento &o)
assignment operator
int optPhotoSwitch
stores the photometric optimizer switch, use OR of HuginBase::OptimizerSwitches
virtual ~PanoramaMemento()
this handler class will receive change events from the Panorama.
void setHFOV(double h, bool keepView=true)
set the horizontal field of view.
bool outputHDRLayers
save remapped layers (HDR)
bool outputLDRExposureLayers
save blended exposure layers, do not perform fusion (no exposure adjustment)
void setProjection(ProjectionFormat f)
set the Projection format and adjust the hfov/vfov if nessecary
BlendingMechanism blendMode
bool outputLDRExposureBlended
< save exposure fused stacks (no exposure adjustment)
vigra_ext::Interpolator interpolator
unsigned int optimizeReferenceImage
void setHeight(unsigned int h)
set panorama height
const std::vector< double > & getProjectionParameters() const
Get the optional projection parameters.
std::string hdrmergeOptions
std::string verdandiOptions
bool outputLDRExposureRemapped
save remapped layers (no exposure adjustment)
void setWidth(unsigned int w, bool keepView=true)
set panorama width keep the HFOV, if keepView=true
void printScriptLine(std::ostream &o, bool forPTOptimizer=false) const
double outputStacksMinOverlap
void setROI(const vigra::Rect2D &val)
EdgeFillMode edgeFillMode
double outputLayersExposureDiff
bool outputLDRBlended
save blended panorama (LDR)
bool outputLDRLayers
save remapped layers (LDR)
PanoramaOptions::ProjectionFormat getProjection() const
double outputExposureValue
bool outputHDRStacks
save image stacks (HDR)
std::string enblendOptions
std::string tiffCompression
std::string outputPixelType
ProjectionFormat
Projection of final panorama.
void setProjectionParameters(const std::vector< double > ¶ms)
set the optional parameters (they need to be of the correct size)
bool outputLDRExposureLayersFused
save blended exposure layers which are then fused (no exposure adjustment)
std::string outputImageType
double outputRangeCompression
std::string outputLayersCompression
std::string outputImageTypeHDRCompression
std::string enfuseOptions
std::string outputImageTypeHDR
std::string outputImageTypeCompression
static FileFormat getFormatFromName(const std::string &name)
returns the FileFormat corrosponding to name.
unsigned int colorReferenceImage
bool outputHDRBlended
save blended panorama (HDR)
UIntSet changedImages
the images that have been changed since the last changeFinished()
const VariableMap getImageVariables(unsigned int imgNr) const
Get the variables of an image.
const SrcPanoImage & getImage(std::size_t nr) const
get a panorama image, counting starts with 0
void imageChanged(unsigned int imgNr)
mark image for change notification.
const PanoramaOptions & getOptions() const
returns the options for this panorama
void updateMasksForImage(unsigned int imgNr, MaskPolygonVector newMasks)
set complete mask list for image with number
CPointVector getCtrlPointsVectorForImage(unsigned int imgNr) const
return a vector of std::pairs with global ctrl point nr and ControlPoint In the class ControlPoint th...
void setOptimizeVector(const OptimizeVector &optvec)
set optimize setting
virtual void UpdateCropFactor(UIntSet imgs, double newCropFactor)
updates the crop factor, try to keep focal length constant
virtual PanoramaDataMemento * getNewMemento() const
get the internal state
std::list< PanoramaObserver * > observers
void setMemento(const PanoramaMemento &memento)
set the internal state
std::vector< unsigned int > getCtrlPointsForImage(unsigned int imgNr) const
return all control points for a given image.
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...
void removeDuplicateCtrlPoints()
removes duplicates control points
void removeImage(unsigned int nr)
creates an image, from filename, and a Lens, if needed
void transferMask(MaskPolygon mask, unsigned int imgNr, const UIntSet &targetImgs)
transfers given mask from image imgNr to all targetImgs
const int getNrOfBands() const
return number of bands of first image (without alpha channel) so it can be 1 for grayscale or 3 for r...
int getNextCPTypeLineNumber() const
get the number of a control point
void updateMasks(bool convertPosMaskToNeg=false)
updates all active masks
void setCtrlPoints(const CPVector &points)
set all control points (Ippei: Is this supposed to be 'add' method?)
void addObserver(PanoramaObserver *o)
add a panorama observer.
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...
void clearObservers()
remove all panorama observers.
const double getMaxExposureDifference() const
returns the maximum exposure value difference of all images in the project
void mergePanorama(const Panorama &newPano)
merges the panorama with the given pano
SrcPanoImage getSrcImage(unsigned imgNr) const
get a description of a source image
const bool hasPossibleStacks() const
return true, if the metadata indicates that the projects is a bracketet project
virtual bool setMementoToCopyOf(const PanoramaDataMemento *const memento)
set the internal state
const int getPhotometricOptimizerSwitch() const
return the photometric optimizer master switch
unsigned int addCtrlPoint(const ControlPoint &point)
add a new control point.
void printPanoramaScript(std::ostream &o, const OptimizeVector &optvars, const PanoramaOptions &options, const UIntSet &imgs, bool forPTOptimizer, const std::string &stripPrefix="") const
create an optimizer script
void checkRefOptStatus(bool &linkRefImgsYaw, bool &linkRefImgsPitch, bool &linkRefImgsRoll)
checks if yaw/pitch/roll of reference image can be check, it depends on number and type of control po...
std::set< std::string > m_ptoptimizerVarNames
std::set< size_t > getRefImages()
returns set of reference image and images linked with reference images
void updateOptimizeVector()
updates the optimize vector according to master switches
virtual void updateVariable(unsigned int imgNr, const Variable &var)
update a single variable
virtual void UpdateFocalLength(UIntSet imgs, double newFocalLength)
updates the focal length by changing hfov
unsigned int addImage(const SrcPanoImage &img)
the the number for a specific image
void swapImages(unsigned int img1, unsigned int img2)
swap images.
void setImageFilename(unsigned int img, const std::string &fname)
set a new image filename
void setOptions(const PanoramaOptions &opt)
set new output settings This is not used directly for optimizing/stiching, but it can be feed into ru...
const std::string getICCProfileDesc() const
return description of icc profile used for pano
void setSrcImage(unsigned int nr, const SrcPanoImage &img)
set input image parameters
void activateImage(unsigned int imgNr, bool active=true)
mark an image as active or inactive.
void changeFinished()
notify observers about changes in this class
void centerCrop(unsigned int imgNr)
center the crop for given image and all linked images
const bool hasPendingChanges() const
return if the panorama class has pending changes normally all controls listen to panoramaChanges noti...
void moveImage(size_t img1, size_t img2)
moves images.
VariableMapVector getVariables() const
get variables of this panorama
const CPVector & getCtrlPoints() const
get all control point of this Panorama
void updateCropMode(unsigned int imgNr)
update the crop mode in dependence of crop rect and lens projection
virtual void updateVariables(const VariableMapVector &vars)
Set the variables.
Panorama getSubset(const UIntSet &imgs) const
get a subset of the panorama
bool dirty
this indicates that there are unsaved changes
void changeControlPoint(unsigned int pNr, const ControlPoint &point)
change a control Point.
void updateCtrlPointErrors(const CPVector &controlPoints)
update control points distances.
bool removeObserver(PanoramaObserver *observer)
remove a panorama observer.
PanoramaData * getUnlinkedSubset(UIntSetVector &imageGroups) const
get a panorama, which does not contain images linked with positions, the cps are moved to the first i...
PanoramaMemento getMemento() const
get the internal state
void setNrOfBands(const int nrBands)
sets the number of bands
const OptimizeVector & getOptimizeVector() const
return the optimize settings stored inside panorama
Panorama duplicate() const
duplicate the panorama
bool WritePTOFile(const std::string &filename, const std::string &prefix="")
write data to given pto file
PanoramaData * getNewSubset(const UIntSet &imgs) const
void setICCProfileDesc(const std::string &newDesc)
sets the icc profile description for check of same profile
void printStitcherScript(std::ostream &o, const PanoramaOptions &target, const UIntSet &imgs) const
create the stitcher script
std::string imgFilePrefix
void setPhotometricOptimizerSwitch(const int newSwitch)
sets the photometric optimizer master switch
void linkPossibleStacks(bool linkPosition)
create automatically stacks as indicated by metadata
const int getOptimizerSwitch() const
returns optimizer master switch
UIntSet getActiveImages() const
get active images
vigra::Rect2D centerCropImage(unsigned int imgNr)
return the centered crop for given image
void reset()
clear the internal state.
void removeCtrlPoint(unsigned int pNr)
remove a control point.
void setFilePrefix(std::string prefix)
sets the path prefix of the images reffered with relative paths
void updateLineCtrlPoints()
assign new mode line numbers, if required
void setOptimizerSwitch(const int newSwitch)
set optimizer master switch
std::size_t getNrOfImages() const
number of images.
All variables of a source image.
void setSize(vigra::Size2D val)
Set the image size in pixels.
bool hasMasks() const
returns true, if image has masks associated
void printMaskLines(std::ostream &o, unsigned int newImgNr) const
writes all mask lines to stream, using given image number
a variable has a value and a name.
const std::string & getName() const
#define DEBUG_ASSERT(cond)
This file specifies what image variables SrcPanoImg should have.
double TranslationPlaneYaw
double TranslationPlanePitch
bool getIntParam(T &value, const std::string &line, const std::string &name)
bool getDoubleParam(double &d, const std::string &line, const std::string &name)
bool getPTParam(std::string &output, const std::string &line, const std::string ¶meter)
helper functions for parsing of a script line
mainly consists of wrapper around the pano tools library, to assist in ressource management and to pr...
std::vector< MaskPolygon > MaskPolygonVector
std::vector< VariableMap > VariableMapVector
void fillVariableMap(VariableMap &vars)
fill map with all image & lens variables
std::vector< ControlPoint > CPVector
std::vector< std::set< std::string > > OptimizeVector
std::vector< CPoint > CPointVector
const int maskOffset
polygon can exceed the image maximal maskOffset pixels in each direction bigger polygons will be clip...
void UpdateOptVectorSet(std::set< std::string > &imgVar, const std::string &var, const bool opt)
std::vector< UIntSet > UIntSetVector
std::set< unsigned int > UIntSet
std::map< std::string, Variable > VariableMap
int FindStackNumberForImage(const std::vector< UIntSet > &imageGroups, const unsigned int imgNr)
std::vector< UIntSet > getExposureLayers(const PanoramaData &pano, UIntSet allImgs, PanoramaOptions opts)
returns vector of set of output exposure layers
bool stringToUInt(const std::string &s, unsigned int &val)
convert string to unsigned integer value, returns true, if sucessful
bool stringToInt(const std::string &s, int &val)
convert string to integer value, returns true, if sucessful
Interpolator
enum with all interpolation methods
bool set_contains(const _Container &c, const typename _Container::key_type &key)
Map::mapped_type & map_get(Map &m, const typename Map::key_type &key)
get a map element.
void fill_set(_Container &c, typename _Container::key_type begin, typename _Container::key_type end)
static const char * varnames[]
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.