From: Pablo d'A. <da...@us...> - 2007-04-17 07:26:14
|
Update of /cvsroot/hugin/hugin/src/hugin In directory sc8-pr-cvs5.sourceforge.net:/tmp/cvs-serv19863/hugin Modified Files: OptimizePhotometricPanel.cpp Log Message: properly handle cases when only a subset of images is optimized Index: OptimizePhotometricPanel.cpp =================================================================== RCS file: /cvsroot/hugin/hugin/src/hugin/OptimizePhotometricPanel.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- OptimizePhotometricPanel.cpp 15 Apr 2007 20:25:05 -0000 1.1 +++ OptimizePhotometricPanel.cpp 17 Apr 2007 07:26:11 -0000 1.2 @@ -123,8 +123,9 @@ // run optimizer // take the OptimizeVector from somewhere. - OptimizeVector optvars = getOptimizeVector(); - m_pano->setOptimizeVector(optvars); + //OptimizeVector optvars = getOptimizeVector(); + //m_pano->setOptimizeVector(optvars); + UIntSet imgs; if (wxConfigBase::Get()->Read(wxT("/General/UseOnlySelectedImages"), @@ -482,11 +483,27 @@ //wxBusyCursor busyc; if (mode != OPT_CUSTOM) { // run automatic optimisation + // ensure that we have a valid anchor. + PanoramaOptions opts = optPano.getOptions(); + if (opts.colorReferenceImage >= optPano.getNrOfImages()) { + opts.colorReferenceImage = 0; + optPano.setOptions(opts); + } smartOptimizePhotometric(optPano, PhotometricOptimizeMode(mode), m_points, progress, error); } else { + OptimizeVector optvars = getOptimizeVector(); + if (optPano.getNrOfImages() != m_pano->getNrOfImages()) { + OptimizeVector o = optvars; + optvars.clear(); + for (UIntSet::const_iterator it = imgs.begin(); + it != imgs.end(); ++it) + { + optvars.push_back(o[*it]); + } + } // optimize selected parameters - optimizePhotometric(optPano, getOptimizeVector(), + optimizePhotometric(optPano, optvars, m_points, progress, error); } } |