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));
139 std::map<unsigned int, unsigned int> script2CPMap;
142 script2CPMap[sc] = ic;
149 assert(cps.size() == script2CPMap.size());
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]))\
220 #undef image_variable
229 for(UIntSet::const_iterator it=imgs.begin();it!=imgs.end();++it)
231 state.
images[*it]->updateFocalLength(newFocalLength);
235 for(UIntSet::const_iterator it=imgs.begin();it!=imgs.end();++it)
263 for(UIntSet::const_iterator it=imgs.begin();it!=imgs.end();++it)
265 state.
images[*it]->updateCropFactor(focalLengthVector[*it],newCropFactor);
275 #define image_variable( name, type, default_value )\
276 void 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;\
284 #undef image_variable
287 #define image_variable( name, type, default_value )\
288 void Panorama::unlinkImageVariable##name(unsigned int imgNr)\
290 state.images[imgNr]->unlink##name();\
291 imageChanged(imgNr);\
292 state.needsOptimization = true;\
295 #undef image_variable
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")
366 for (
unsigned int i=imgNr; i <
state.
images.size(); i++) {
395 unsigned int i1 = point.image1Nr;
396 unsigned int i2 = point.image2Nr;
408 std::set<std::string> listOfCPs;
409 std::set<unsigned int> duplicateCPs;
413 std::pair<std::set<std::string>::iterator,
bool> it=listOfCPs.insert(s);
416 duplicateCPs.insert(i);
420 if(!duplicateCPs.empty())
422 for(std::set<unsigned int>::reverse_iterator it=duplicateCPs.rbegin();it!=duplicateCPs.rend();++it)
474 std::map<int, int> lines;
482 for (std::map<int,int >::iterator it = lines.begin(); it != lines.end(); ++it)
492 int newmode = lines[it->mode];
493 if (it->mode != newmode) {
508 const std::string & stripPrefix)
const
511 char * old_locale = strdup(setlocale(LC_NUMERIC, NULL));
512 setlocale(LC_NUMERIC,
"C");
514 if (forPTOptimizer) {
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;
531 std::stringstream vlines;
532 std::stringstream masklines;
534 for (UIntSet::const_iterator imgNrIt = imgs.begin(); imgNrIt != imgs.end();
537 unsigned int imgNr = *imgNrIt;
538 imageNrMap[imgNr] = ic;
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) << " ";\
625 #undef image_variable
629 vigra::Rect2D c = img.getCropRect();
630 o <<
" S" << c.left() <<
"," << c.right() <<
"," << c.top() <<
"," << c.bottom();
633 if (!forPTOptimizer) {
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();
647 img.printMaskLines(masklines,ic);
652 o <<
" u" << output.featherWidth
653 << (img.getMorph() ?
" o" :
"");
655 std::string fname = img.getFilename();
656 if (!stripPrefix.empty()) {
659 std::string tmp = fname.substr(0,stripPrefix.size());
660 if (tmp.compare(stripPrefix) == 0) {
661 DEBUG_DEBUG(
"striping " << stripPrefix <<
" from " << fname);
662 fname = fname.erase(0,stripPrefix.size());
665 DEBUG_DEBUG(stripPrefix <<
" does not match " << fname);
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;
681 o <<
"c n" << imageNrMap[it->image1Nr]
682 <<
" N" << imageNrMap[it->image2Nr]
683 <<
" x" << it->x1 <<
" y" << it->y1
684 <<
" X" << it->x2 <<
" Y" << it->y2
685 <<
" t" << it->mode << std::endl;
690 if(masklines.str().length()>0)
691 o <<
"# masks" << std::endl
697 o <<
"#hugin_blender ";
703 o <<
"PTblender" << endl;
706 o <<
"smartblend" << endl;
709 o <<
"PTmasker" << endl;
712 o <<
"internal" << endl;
716 o <<
"enblend" << endl;
720 o <<
"#hugin_remapper ";
723 o <<
"PTmender" << endl;
732 o <<
"#hugin_enfuseOptions " << output.
enfuseOptions << 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;
743 o <<
"#hugin_outputLDRStacks " << (output.
outputLDRStacks ?
"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;
752 o <<
"#hugin_outputJPEGQuality " << output.
quality << endl;
768 o <<
"#hugin_optimizerMasterSwitch 0" << endl;
769 o <<
"#hugin_optimizerPhotoMasterSwitch 0" << endl;
773 setlocale(LC_NUMERIC,old_locale);
783 char * old_locale = strdup(setlocale(LC_NUMERIC, NULL));
784 setlocale(LC_NUMERIC,
"C");
786 o <<
"# PTStitcher script, written by hugin" << std::endl
791 <<
"# output image lines" << std::endl;
792 for (UIntSet::const_iterator imgNrIt = imgs.begin(); imgNrIt != imgs.end(); ++imgNrIt) {
793 unsigned int imgNr = *imgNrIt;
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();
826 setlocale(LC_NUMERIC,old_locale);
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);
892 if(targetImgs.empty())
898 vigra::Rect2D clipRect=vigra::Rect2D(0,0,
state.
images[imgNr]->getWidth(),
state.
images[imgNr]->getHeight());
905 clipRect=clipRect &
state.
images[imgNr]->getCropRect();
906 if(clipRect.isEmpty())
910 if(clipRect.width()>10 && clipRect.height()>10)
912 clipRect.addBorder(-2);
917 vigra::Rect2D cropRect=
state.
images[imgNr]->getCropRect();
918 hugin_utils::FDiff2D center((cropRect.left()+cropRect.right())/2.0,(cropRect.top()+cropRect.bottom())/2.0);
919 double radius=((cropRect.width()<cropRect.height())?cropRect.width():cropRect.height())/2.0;
931 if(clipRect.width()>10 && clipRect.height()>10)
933 clipRect.addBorder(-2);
948 for(UIntSet::const_iterator it=targetImgs.begin();it!=targetImgs.end();++it)
962 targetMask=transformedMask;
974 targetMask.
setInverted(origWindingNumber * newWindingNumber < 0);
997 imgWithPosMasks.insert(i);
1010 for(
unsigned int j=0;j<masks.size();j++)
1012 if(convertPosMaskToNeg)
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);
1120 std::set_intersection(imgStack.begin(),imgStack.end(),imgOverlap.begin(),imgOverlap.end(),inserter(imgs,imgs.begin()));
1133 masks[j].setImgNr(k);
1149 vigra::Rect2D r=
state.
images[imgNr]->getCropRect();
1150 if(r.isEmpty() || r==vigra::Rect2D(
state.
images[imgNr]->getSize()))
1169 vigra::Rect2D cropRect;
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);
1179 cropRect.setUpperLeft( center - d);
1180 cropRect.setLowerRight( center + d);
1186 vigra::Rect2D cropRect;
1193 if(!cropRect.isEmpty())
1213 if(!cropRect.isEmpty())
1238 std::set<size_t> refImgs;
1239 refImgs.insert(refImg);
1246 if (refImage.YawisLinkedWith(compImage))
1248 refImgs.insert(imgNr);
1261 for (CPVector::const_iterator it = cps.begin(); it != cps.end(); ++it)
1279 linkRefImgsYaw=
false;
1280 linkRefImgsPitch=
false;
1281 linkRefImgsRoll=
false;
1285 linkRefImgsRoll = nVCP + nHCP >= 1;
1286 linkRefImgsYaw = nVCP + nHCP >= 3 && nVCP >= 1 && nHCP >= 1;
1287 linkRefImgsPitch = nVCP + nHCP >= 2;
1291 linkRefImgsPitch = nHCP + nVCP > 1;
1292 linkRefImgsRoll = nHCP + nVCP >= 1;
1308 bool linkRefImgsYaw=
false;
1309 bool linkRefImgsPitch=
false;
1310 bool linkRefImgsRoll=
false;
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;
1432 imgList.erase(imgList.begin()+img1);
1433 if(img2<imgList.size())
1435 imgList.insert(imgList.begin()+img2, img1);
1439 imgList.push_back(img1);
1442 std::map<size_t,size_t> imgMap;
1443 for(
size_t i=0; i<imgList.size(); i++)
1445 imgMap[imgList[i]]=i;
1449 for(
size_t i=0; i<imgList.size(); i++)
1470 (*it).image1Nr = imgMap[(*it).image1Nr];
1471 (*it).image2Nr = imgMap[(*it).image2Nr];
1473 if ((*it).image1Nr > (*it).image2Nr)
1495 }
catch (std::bad_cast&) {
1517 unsigned int nNewImages = state.images.size();
1521 for (
unsigned int i = 0; i < nNewImages; i++) {
1589 for (
unsigned int i = 0; i <
state.
images.size(); i++) {
1592 activeImgs.insert(i);
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
1685 std::set_difference(allImgs.begin(), allImgs.end(), imgs.begin(), imgs.end(), std::inserter(unusedImgs, unusedImgs.end()));
1687 if (!unusedImgs.empty())
1689 for (
auto& i : unusedImgs)
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();
1720 subset.
state.
optvec.push_back(internalOptvec[*imgNrIt]);
1721 imageNrMap[*imgNrIt] = ic;
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
1753 ControlPoint pnt = *it;
1754 pnt.image1Nr = imageNrMap[pnt.image1Nr];
1755 pnt.image2Nr = imageNrMap[pnt.image2Nr];
1761 unsigned int newRefImg=0;
1763 if(it!=imageNrMap.end())
1765 newRefImg=it->second;
1770 if(it!=imageNrMap.end())
1772 newRefImg=it->second;
1780 for (
size_t i = 0; i < imageGroups.size(); ++i)
1796 imageGroups.clear();
1800 if (visitedImages[i])
1807 visitedImages[i] =
true;
1808 if (img1.YawisLinked())
1812 if (img1.YawisLinkedWith(
getImage(j)))
1815 visitedImages[j] =
true;
1819 imageGroups.push_back(imgs);
1822 for (
size_t i = 0; i < imageGroups.size(); ++i)
1824 singleStackImgs.insert(*imageGroups[i].begin());
1830 if (newRefImage != -1)
1838 for (CPVector::const_iterator it = cps.begin(); it != cps.end(); ++it)
1845 if (newImg1 != -1 && newImg2 != -1 && newImg1 != newImg2)
1849 newCP.push_back(cp);
1861 std::vector<unsigned int> new_image_nr(newPano.
getNrOfImages());
1870 std::string filename=newPano.
getImage(i).getFilename();
1874 if(
getImage(j).getFilename()==filename)
1879 imgsAlreadyInPano.insert(i);
1883 if(!masksNew.empty())
1885 for(
unsigned int k=0;k<masksNew.size();k++)
1887 bool usedMasks=
false;
1889 while((!usedMasks) && l<masksOld.size())
1891 usedMasks=(masksNew[k]==masksOld[l]);
1895 masksOld.push_back(masksNew[k]);
1905 SrcPanoImage newImg(newPano.
getImage(i));
1908 imgsCheckLens.insert(i);
1910 optVec.push_back(optVecNew[i]);
1918 if (!imgsAlreadyInPano.empty())
1920 for (
auto img : imgsAlreadyInPano)
1922 const size_t initialLensNumber = newLenses.getPartNumber(img);
1923 const size_t newLensNumber = oldLenses.getPartNumber(new_image_nr[img]);
1931 oldLenses.switchParts(new_image_nr[j], newLensNumber);
1932 imgsCheckLens.erase(j);
1933 lensImgs[initialLensNumber].erase(j);
1936 lensImgs[initialLensNumber].erase(img);
1939 if (!imgsCheckLens.empty())
1943 while (i < lensImgs.size() && lensImgs[i].empty())
1947 if (i < lensImgs.size())
1950 size_t matchingLensNumber = -1;
1951 for (
size_t j = 0; j < oldImgNumber; ++j)
1954 if (compareImage.getSize() == srcImage.getSize() &&
1955 compareImage.getExifModel() == srcImage.getExifModel() &&
1956 compareImage.getExifMake() == srcImage.getExifMake() &&
1957 compareImage.getExifFocalLength() == srcImage.getExifFocalLength())
1959 matchingLensNumber = oldLenses.getPartNumber(j);
1964 if (matchingLensNumber >= 0)
1966 for (
size_t j : lensImgs[i])
1968 oldLenses.switchParts(new_image_nr[j], matchingLensNumber);
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)
1997 new_image_nr[cps[i].image2Nr], cps[i].x2, cps[i].y2, cps[i].mode + nextLineCPOffset));
2003 new_image_nr[cps[i].image2Nr], cps[i].x2, cps[i].y2, cps[i].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());
2033 if (!dataInput.good() || dataInput.eof())
2035 std::cerr <<
"could not open script : " << filename << std::endl;
2041 const bool result = newPano.
loadPTScript(dataInput, ptoVersion, prefix);
2054 std::cerr <<
"error while parsing panos tool script: " << filename << std::endl;
2061 std::ofstream outputStream(filename, std::ofstream::out | std::ofstream::trunc);
2062 if (outputStream.good())
2073 catch (std::exception& e)
2076 outputStream.close();
2077 std::cerr <<
"Failed to write project file " << filename <<
" (error: " << e.what() <<
")" << std::endl;
2080 outputStream.close();
2085 std::cerr <<
"Failed to write project file " << filename <<
" (Can not create file.)" << std::endl;
2099 modified_images.insert(i);
2110 modified_images.insert(j);
2126 double minEv = 1000;
2127 double maxEv = -1000;
2130 const double ev =
state.
images[i]->getExposureValue();
2134 return maxEv - minEv;
2154 if (evValues.size()<2)
2170 for (
size_t layerNr = 1; layerNr < evValues.size(); ++layerNr)
2172 if (evValues[0].size() != evValues[layerNr].size())
2189 for (
size_t imgNr = 0; imgNr <
state.
images.size(); imgNr++)
2193 unlinkImageVariableYaw(imgNr);
2194 unlinkImageVariablePitch(imgNr);
2195 unlinkImageVariableRoll(imgNr);
2196 unlinkImageVariableX(imgNr);
2197 unlinkImageVariableY(imgNr);
2198 unlinkImageVariableZ(imgNr);
2199 unlinkImageVariableTranslationPlaneYaw(imgNr);
2200 unlinkImageVariableTranslationPlanePitch(imgNr);
2204 unlinkImageVariableStack(imgNr);
2211 if (evValues.empty())
2215 unsigned int imgNr = 0;
2224 linkImageVariableStack(imgNr, i);
2227 linkImageVariableYaw(imgNr, i);
2228 linkImageVariablePitch(imgNr, i);
2229 linkImageVariableRoll(imgNr, i);
2230 linkImageVariableX(imgNr, i);
2231 linkImageVariableY(imgNr, i);
2232 linkImageVariableZ(imgNr, i);
2233 linkImageVariableTranslationPlaneYaw(imgNr, i);
2234 linkImageVariableTranslationPlanePitch(imgNr, i);
2260 for (std::vector<SrcPanoImage *>::const_iterator it = data.
images.begin();
2261 it != data.
images.end(); ++it)
2263 images.push_back(
new SrcPanoImage(*(*it)));
2272 std::size_t num_imgs =
images.size();
2273 for (std::size_t i = 0; i < num_imgs; i++)
2278 for (std::size_t j = i + 1; j < num_imgs; j++)
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();
2314 it !=
images.end(); ++it)
2326 char * p = setlocale(LC_NUMERIC,NULL);
2327 char * old_locale = strdup(p);
2328 setlocale(LC_NUMERIC,
"C");
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;
2339 std::vector<PTScriptParsing::ImgInfo> huginImgInfo;
2345 bool skipNextLine =
false;
2347 bool PTGUIScriptFile =
false;
2348 int PTGUIScriptVersion = 0;
2350 int ctrlPointsImgNrOffset = 0;
2351 bool PTGUILensLine =
false;
2353 bool PTGUILensLoaded =
false;
2354 PTScriptParsing::ImgInfo PTGUILens;
2362 bool firstOptVecParse =
true;
2363 unsigned int lineNr = 0;
2365 std::getline(i, line);
2366 if (line.find_first_of(controlCharacters, 0) != std::string::npos)
2371 setlocale(LC_NUMERIC, old_locale);
2379 skipNextLine =
false;
2415 int left, right, top, bottom;
2416 int n = sscanf(format.c_str(),
"%d,%d,%d,%d", &left, &right, &top, &bottom);
2420 DEBUG_WARN(
"Could not parse crop string: " << format);
2426 char * tstr = strdup(format.c_str());
2427 std::vector<double> projParam;
2428 char * b = strtok(tstr,
" \"");
2432 if (sscanf(b,
"%lf", &tempDbl) == 1) {
2433 projParam.push_back(tempDbl);
2434 b = strtok(NULL,
" \"");
2449 int t = format.find(
' ');
2480 if (comp ==
"NONE" || comp ==
"LZW" ||
2481 comp ==
"PACKBITS" || comp ==
"DEFLATE")
2485 DEBUG_WARN(
"No valid tiff compression found");
2490 if (comp ==
"CROP") {
2522 if (!PTGUIScriptFile) {
2523 if (firstOptVecParse) {
2524 int nImg =
std::max(iImgInfo.size(), oImgInfo.size());
2527 firstOptVecParse =
false;
2529 std::stringstream optstream;
2530 optstream << line.substr(1);
2532 while (!(optstream >> std::ws).eof()) {
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);
2569 point.image1Nr += ctrlPointsImgNrOffset;
2571 point.image2Nr += ctrlPointsImgNrOffset;
2581 loadedCp.push_back(point);
2590 if (PTGUILensLine) {
2591 PTGUILensLine =
false;
2592 PTGUILensLoaded =
true;
2593 PTGUILens.parse(line);
2595 iImgInfo.push_back(PTScriptParsing::ImgInfo(line));
2601 if (PTGUILensLine) {
2602 PTGUILensLine =
false;
2603 PTGUILensLoaded =
true;
2604 PTGUILens.parse(line);
2606 oImgInfo.push_back(PTScriptParsing::ImgInfo(line));
2616 MaskPolygon newPolygon;
2617 newPolygon.setImgNr(param);
2623 if(newPolygon.parsePolygonString(format))
2624 ImgMasks.push_back(newPolygon);
2633 if (line.substr(0,20) == std::string(
"# ptGui project file")) {
2634 PTGUIScriptFile =
true;
2636 if (line.substr(0,12) ==
"#-dummyimage") {
2637 PTGUILensLine =
true;
2639 if (PTGUIScriptFile) {
2641 if (sscanf(line.c_str(),
"#-fileversion %d", &PTGUIScriptVersion) > 0) {
2642 DEBUG_DEBUG(
"Detected PTGUI script version: " << PTGUIScriptVersion);
2643 switch (PTGUIScriptVersion) {
2661 ctrlPointsImgNrOffset = -1;
2668 if (line.substr(0,8) ==
"#-hugin ") {
2670 PTScriptParsing::ImgInfo
info;
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);
2677 if(cropFactor<0.01 || cropFactor > 100)
2679 info.cropFactor = cropFactor;
2681 pos = line.find(
"disabled");
2682 if (pos > 0 && pos < line.length()) {
2683 info.enabled =
false;
2685 huginImgInfo.push_back(info);
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) <<
":")
2712 std::string nextFilename;
2714 b = line.find_first_not_of(
" \"",e);
2715 e = line.find_first_of(
"\"",b);
2716 nextFilename = line.substr(b,e-b);
2717 }
catch (std::out_of_range& e) {
2718 DEBUG_ERROR(
"ERROR PARSING INPUT FILE" << e.what( ));
2723 PTScriptParsing::ImgInfo
info;
2724 info.width = nextWidth;
2725 info.height = nextHeight;
2726 info.filename = nextFilename;
2727 cImgInfo.push_back(info);
2732 if (line.substr(0,7) ==
"#hugin_") {
2733 std::istringstream is(line);
2734 std::string var,value;
2737 if (var ==
"#hugin_ptoversion") {
2738 ptoVersion = atoi(value.c_str());
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") {
2887 if (PTGUILensLoaded) {
2891 map_get(l.variables, *v).setValue(PTGUILens.vars[*v]);
2893 l.setImageSize(vigra::Size2D(PTGUILens.width, PTGUILens.height));
2896 lenses.push_back(l);
2927 int nImgs = iImgInfo.size();
2928 int nOLines = oImgInfo.size();
2929 int nCLines = cImgInfo.size();
2931 if (nImgs < nOLines) {
2933 DEBUG_DEBUG(
"throwing away " << nImgs <<
" i lines");
2934 iImgInfo = oImgInfo;
2937 if (nOLines < nImgs) {
2938 oImgInfo = iImgInfo;
2942 for (
int i=0; i < nImgs; i++) {
2950 if ((iImgInfo[i].links[*v] == -2 && oImgInfo[i].links[*v] != -2) || (iImgInfo[i].links[*v] == -1 && oImgInfo[i].links[*v] >=0)) {
2952 iImgInfo[i].vars[*v] = oImgInfo[i].vars[*v];
2953 iImgInfo[i].links[*v] = oImgInfo[i].links[*v];
2957 if (iImgInfo[i].filename ==
"" && oImgInfo[i].filename !=
"") {
2959 iImgInfo[i].filename = oImgInfo[i].filename;
2962 if (iImgInfo[i].crop.isEmpty() && !oImgInfo[i].crop.isEmpty()) {
2964 iImgInfo[i].crop = oImgInfo[i].crop;
2967 if (iImgInfo[i].width <= 0 && oImgInfo[i].width > 0) {
2969 iImgInfo[i].width = oImgInfo[i].width;
2972 if (iImgInfo[i].height <= 0 && oImgInfo[i].height > 0) {
2974 iImgInfo[i].height = oImgInfo[i].height;
2977 if (iImgInfo[i].f < 0 && oImgInfo[i].f > 0) {
2979 iImgInfo[i].f = oImgInfo[i].f;
2982 if (nCLines == nImgs) {
2984 if (cImgInfo[i].filename !=
"" && cImgInfo[i].width > 0) {
2986 iImgInfo[i].filename = cImgInfo[i].filename;
2987 iImgInfo[i].width = cImgInfo[i].width;
2988 iImgInfo[i].height = cImgInfo[i].height;
2991 if (huginImgInfo.size() == (size_t)nImgs) {
2992 iImgInfo[i].cropFactor = huginImgInfo[i].cropFactor;
2993 iImgInfo[i].autoCenterCrop = huginImgInfo[i].autoCenterCrop;
2994 iImgInfo[i].enabled= huginImgInfo[i].enabled;
2999 for (
int i=0; i < nImgs; i++) {
3008 std::string name(*v);
3009 double val = iImgInfo[i].vars[*v];
3010 map_get(vars,name).setValue(val);
3011 if (iImgInfo[i].links[*v] >= 0) {
3012 link = iImgInfo[i].links[*v];
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);
3029 SrcPanoImage * new_img_p =
new SrcPanoImage();
3030 images.push_back(new_img_p);
3032 SrcPanoImage & new_img = *new_img_p;
3033 new_img.setFilename(file);
3034 new_img.setSize(vigra::Size2D(iImgInfo[i].width, iImgInfo[i].height));
3035 new_img.checkImageSizeKnown();
3042 SrcPanoImage name_src;
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
3120 new_img.setFeatherWidth((
unsigned int) iImgInfo[i].blend_radius);
3124 new_img.setCropFactor(iImgInfo[i].cropFactor);
3125 new_img.setVigCorrMode(iImgInfo[i].vigcorrMode);
3126 new_img.setFlatfieldFilename(iImgInfo[i].flatfieldname);
3128 new_img.setAutoCenterCrop(iImgInfo[i].autoCenterCrop);
3129 new_img.setActive(iImgInfo[i].enabled);
3131 if (!iImgInfo[i].crop.isEmpty()) {
3132 if (new_img.isCircularCrop())
3138 new_img.setCropRect(iImgInfo[i].crop);
3142 for(
unsigned int j=0;j<ImgMasks.size();j++)
3143 if(ImgMasks[j].getImgNr()==i)
3148 new_img.addMask(ImgMasks[j]);
3157 if (!loadedCp.empty())
3160 const size_t nrImg =
images.size();
3161 for (CPVector::const_iterator it = loadedCp.begin(); it != loadedCp.end(); ++it)
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;
3201 setlocale(LC_NUMERIC,old_locale);
std::set< size_t > getRefImages()
returns set of reference image and images linked with reference images
static const char * variableNames[]
PanoramaOptions::ProjectionFormat getProjection() const
An ImageVariableGroup is a collection of image variables that can have some shared variable values...
static const std::set< ConstImageVariableGroup::ImageVariableEnum > & getLensVariables()
Get the set of lens image variables.
void imageChanged(unsigned int imgNr)
mark image for change notification.
declaration of functions to handle stacks and layers
EdgeFillMode edgeFillMode
void updateOptimizeVector()
updates the optimize vector according to master switches
double outputRangeCompression
std::vector< UIntSet > UIntSetVector
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...
std::vector< UIntSet > getExposureLayers(const PanoramaData &pano, UIntSet allImgs, PanoramaOptions opts)
returns vector of set of output exposure layers
void fillVariableMap(VariableMap &vars)
fill map with all image & lens variables
void setMemento(const PanoramaMemento &memento)
set the internal state
void setHeight(unsigned int h)
set panorama height
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 const char * varnames[]
std::list< PanoramaObserver * > observers
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...
void updateCtrlPointErrors(const CPVector &controlPoints)
update control points distances.
SrcPanoImage getSrcImage(unsigned imgNr) const
get a description of a source image
virtual void setCtrlPoints(const CPVector &points)=0
set all control points (Ippei: Is this supposed to be 'add' method?)
void UpdateOptVectorSet(std::set< std::string > &imgVar, const std::string &var, const bool opt)
PanoramaData * getNewSubset(const UIntSet &imgs) const
bool outputLDRLayers
save remapped layers (LDR)
const int maskOffset
polygon can exceed the image maximal maskOffset pixels in each direction bigger polygons will be clip...
bool removeObserver(PanoramaObserver *observer)
remove a panorama observer.
std::string outputLayersCompression
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...
std::string imgFilePrefix
void setFilePrefix(std::string prefix)
sets the path prefix of the images reffered with relative paths
void setPhotometricOptimizerSwitch(const int newSwitch)
sets the photometric optimizer master switch
std::string outputImageTypeHDRCompression
vigra::Rect2D centerCropImage(unsigned int imgNr)
return the centered crop for given image
bool outputHDRLayers
save remapped layers (HDR)
std::set< std::string > m_ptoptimizerVarNames
Somewhere to specify what variables belong to what.
const std::string & getName() const
void swapImages(unsigned int img1, unsigned int img2)
swap images.
bool getIntParam(T &value, const std::string &line, const std::string &name)
std::vector< SrcPanoImage * > images
The images inside the panorama.
int getNextCPTypeLineNumber() const
get the number of a control point
a variable has a value and a name.
bool set_contains(const _Container &c, const typename _Container::key_type &key)
#define DEBUG_ASSERT(cond)
std::string enfuseOptions
virtual bool setMementoToCopyOf(const PanoramaDataMemento *const memento)
set the internal state
void updateLineCtrlPoints()
assign new mode line numbers, if required
void setProjectionParameters(const std::vector< double > ¶ms)
set the optional parameters (they need to be of the correct size)
void calculate(unsigned int steps)
does the calculation, for each image steps*steps points are extracted and tested with all other image...
Panorama getSubset(const UIntSet &imgs) const
get a subset of the panorama
double TranslationPlanePitch
const CPVector & getCtrlPoints() const
get all control point of this Panorama
int optSwitch
stores the optimizer switch, use OR of HuginBase::OptimizerSwitches
std::string outputImageTypeCompression
vigra::pair< typename ROIImage< Image, Mask >::image_const_traverser, typename ROIImage< Image, Mask >::ImageConstAccessor > srcImage(const ROIImage< Image, Mask > &img)
void setOptimizerSwitch(const int newSwitch)
set optimizer master switch
bool getPTParam(std::string &output, const std::string &line, const std::string ¶meter)
helper functions for parsing of a script line
represents a control point
virtual void updateVariables(const VariableMapVector &vars)
Set the variables.
unsigned int colorReferenceImage
void setOptimizeVector(const OptimizeVector &optvec)
set optimize setting
static FileFormat getFormatFromName(const std::string &name)
returns the FileFormat corrosponding to name.
bool outputLDRExposureBlended
< save exposure fused stacks (no exposure adjustment)
int optPhotoSwitch
stores the photometric optimizer switch, use OR of HuginBase::OptimizerSwitches
bool stringToUInt(const std::string &s, unsigned int &val)
convert string to unsigned integer value, returns true, if sucessful
VectorPolygon getMaskPolygon() const
returns vector with coordinates of the polygon
Panorama duplicate() const
duplicate the panorama
#define check_stack_link(name)
std::set< unsigned int > UIntSet
virtual void UpdateCropFactor(UIntSet imgs, double newCropFactor)
updates the crop factor, try to keep focal length constant
int FindStackNumberForImage(const std::vector< UIntSet > &imageGroups, const unsigned int imgNr)
std::vector< VariableMap > VariableMapVector
void linkPossibleStacks(bool linkPosition)
create automatically stacks as indicated by metadata
virtual void setDirty(const bool &dirty=true)
void setInverted(const bool inverted)
set mask to normal or inverted
empirical model of response
bool outputLDRBlended
save blended panorama (LDR)
ConstImageVariableGroup & getLenses()
Get the ImageVariableGroup representing the group of lens variables.
unsigned int addCtrlPoint(const ControlPoint &point)
add a new control point.
const OptimizeVector & getOptimizeVector() const
return the optimize settings stored inside panorama
bool loadPTScript(std::istream &i, int &ptoVersion, const std::string &prefix="")
load a Hugin file
some definitions to work with optimizer master switches
VariableMapVector getVariables() const
get variables of this panorama
const VariableMap getImageVariables(unsigned int imgNr) const
Get the variables of an image.
int getTotalWindingNumber() const
returns the total winding number of the polygon
double outputLayersExposureDiff
void transformPolygon(const PTools::Transform &trans)
transforms the polygon coordinates by the given transformation
std::size_t getNrOfImages() const
number of images.
double TranslationPlaneYaw
std::vector< unsigned int > getCtrlPointsForImage(unsigned int imgNr) const
return all control points for a given image.
void setCtrlPoints(const CPVector &points)
set all control points (Ippei: Is this supposed to be 'add' method?)
Map::mapped_type & map_get(Map &m, const typename Map::key_type &key)
get a map element.
void centerCrop(unsigned int imgNr)
center the crop for given image and all linked images
vigra_ext::Interpolator interpolator
UIntSet getOverlapForImage(unsigned int i) const
returns a set of images which overlap with given image number
MaskType
enumeration with type of possible masks
double outputStacksMinOverlap
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...
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...
void clearObservers()
remove all panorama observers.
virtual const PanoramaOptions & getOptions() const =0
returns the options for this panorama
int bands
number of bands of first image (without alpha channel), currently we can't mix grayscale and RGB imag...
virtual ~PanoramaMemento()
bool outputHDRBlended
save blended panorama (HDR)
void activateImage(unsigned int imgNr, bool active=true)
mark an image as active or inactive.
evaluate x, points are on a vertical line
Make an ImageVariableGroup for lenses and other common concepts.
void setImageFilename(unsigned int img, const std::string &fname)
set a new image filename
const bool hasPendingChanges() const
return if the panorama class has pending changes normally all controls listen to panoramaChanges noti...
bool clipPolygon(const vigra::Rect2D rect)
clips the polygon to the given rectangle
bool stringToInt(const std::string &s, int &val)
convert string to integer value, returns true, if sucessful
void removeImage(unsigned int nr)
creates an image, from filename, and a Lens, if needed
void printScriptLine(std::ostream &o, bool forPTOptimizer=false) const
std::vector< MaskPolygon > MaskPolygonVector
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 setROI(const vigra::Rect2D &val)
unsigned int addImage(const SrcPanoImage &img)
the the number for a specific image
void changeFinished()
notify observers about changes in this class
virtual PanoramaDataMemento * getNewMemento() const
get the internal state
const std::string getICCProfileDesc() const
return description of icc profile used for pano
UIntSet getActiveImages() const
get active images
std::vector< CPoint > CPointVector
std::string tiffCompression
std::map< std::string, Variable > VariableMap
std::string verdandiOptions
void updateMasks(bool convertPosMaskToNeg=false)
updates all active masks
void transferMask(MaskPolygon mask, unsigned int imgNr, const UIntSet &targetImgs)
transfers given mask from image imgNr to all targetImgs
Same as above, but use a non const panorama.
bool outputLDRExposureLayers
save blended exposure layers, do not perform fusion (no exposure adjustment)
PanoramaMemento getMemento() const
get the internal state
void setHFOV(double h, bool keepView=true)
set the horizontal field of view.
void addObserver(PanoramaObserver *o)
add a panorama observer.
void setImgNr(const unsigned int newImgNr)
sets the associated image number, only used when loading a project, otherwise discarded ...
Convenience functions for SrcPanoImage to use on the image variables.
std::string enblendOptions
void setICCProfileDesc(const std::string &newDesc)
sets the icc profile description for check of same profile
const PanoramaOptions & getOptions() const
returns the options for this panorama
this handler class will receive change events from the Panorama.
const int getPhotometricOptimizerSwitch() const
return the photometric optimizer master switch
void updateCropMode(unsigned int imgNr)
update the crop mode in dependence of crop rect and lens projection
options wxIntPtr wxIntPtr sortData std::vector< PanoInfo > * data
bool outputLDRExposureRemapped
save remapped layers (no exposure adjustment)
definitions of classes to calculate overlap between different images
const std::vector< double > & getProjectionParameters() const
Get the optional projection parameters.
Memento class for a Panorama object.
void removeDuplicateCtrlPoints()
removes duplicates control points
bool outputLDRExposureLayersFused
save blended exposure layers which are then fused (no exposure adjustment)
const int getOptimizerSwitch() const
returns optimizer master switch
Memento class for a PanoramaData object.
void setMaskType(const MaskType newType)
sets mask type
UIntSet changedImages
the images that have been changed since the last changeFinished()
std::string outputImageType
bool isPositive() const
returns true, if mask type is positive
bool dirty
this indicates that there are unsaved changes
std::string outputImageTypeHDR
void subSample(const double max_distance)
subsamples the polygon, so that the longest distance between 2 points is max_distance ...
void removeCtrlPoint(unsigned int pNr)
remove a control point.
std::vector< ControlPoint > CPVector
std::string outputPixelType
bool WritePTOFile(const std::string &filename, const std::string &prefix="")
write data to given pto file
static void info(const char *fmt,...)
std::vector< std::set< std::string > > OptimizeVector
class for calculating overlap of images
bool getDoubleParam(double &d, const std::string &line, const std::string &name)
std::string hdrmergeOptions
const SrcPanoImage & getImage(std::size_t nr) const
get a panorama image, counting starts with 0
void fill_set(_Container &c, typename _Container::key_type begin, typename _Container::key_type end)
void setOptions(const PanoramaOptions &opt)
set new output settings This is not used directly for optimizing/stiching, but it can be feed into ru...
ProjectionFormat
Projection of final panorama.
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 setSrcImage(unsigned int nr, const SrcPanoImage &img)
set input image parameters
PanoramaMemento & operator=(const PanoramaMemento &o)
assignment operator
void setNrOfBands(const int nrBands)
sets the number of bands
Interpolator
enum with all interpolation methods
void updateMasksForImage(unsigned int imgNr, MaskPolygonVector newMasks)
set complete mask list for image with number
All variables of a source image.
void setProjection(ProjectionFormat f)
set the Projection format and adjust the hfov/vfov if nessecary
bool outputHDRStacks
save image stacks (HDR)
virtual void updateVariable(unsigned int imgNr, const Variable &var)
update a single variable
const bool hasPossibleStacks() const
return true, if the metadata indicates that the projects is a bracketet project
This file specifies what image variables SrcPanoImg should have.
const double getMaxExposureDifference() const
returns the maximum exposure value difference of all images in the project
evaluate y, points are on a horizontal line
void reset()
clear the internal state.
BlendingMechanism blendMode
void mirror()
swap (image1Nr,x1,y1) with (image2Nr,x2,y2)
base class, which stores one mask polygon
std::string iccProfileDesc
description of the icc profile
PanoramaData * getUnlinkedSubset(UIntSetVector &imageGroups) const
get a panorama, which does not contain images linked with positions, the cps are moved to the first i...
void mergePanorama(const Panorama &newPano)
merges the panorama with the given pano
void limitToImages(UIntSet img)
limits the calculation of the overlap to given image numbers
void setWidth(unsigned int w, bool keepView=true)
set panorama width keep the HFOV, if keepView=true
void printStitcherScript(std::ostream &o, const PanoramaOptions &target, const UIntSet &imgs) const
create the stitcher script
BaseSrcPanoImage::Projection LensProjectionFormat
double outputExposureValue
unsigned int optimizeReferenceImage
virtual void UpdateFocalLength(UIntSet imgs, double newFocalLength)
updates the focal length by changing hfov