From: Pablo d'A. <da...@us...> - 2006-02-25 19:00:39
|
Update of /cvsroot/hugin/hugin/src/include/hugin In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10042/include/hugin Modified Files: wxPanoCommand.h Log Message: detect and correct if image size specified in .pto file differs from the actual image size. Index: wxPanoCommand.h =================================================================== RCS file: /cvsroot/hugin/hugin/src/include/hugin/wxPanoCommand.h,v retrieving revision 1.28 retrieving revision 1.29 diff -u -d -r1.28 -r1.29 --- wxPanoCommand.h 13 Jan 2006 22:10:08 -0000 1.28 +++ wxPanoCommand.h 25 Feb 2006 19:00:34 -0000 1.29 @@ -157,20 +157,20 @@ for (unsigned int i = 0; i < nImg; i++) { wxFileName fname(wxString (pano.getImage(i).getFilename().c_str(), *wxConvCurrent)); while (! fname.FileExists()){ - // Is file in the new path - if (basedir != wxT("")) { - wxString newname = fname.GetFullName(); - fname.AssignDir(basedir); - fname.SetFullName(newname); - if (fname.FileExists()) { - pano.setImageFilename(i, (const char *)fname.GetFullPath().mb_str()); - DEBUG_TRACE("New filename set: " << fname.GetFullPath().mb_str()); - // TODO - set pano dirty flag so that new paths are saved - continue; - } - } + // Is file in the new path + if (basedir != wxT("")) { + wxString newname = fname.GetFullName(); + fname.AssignDir(basedir); + fname.SetFullName(newname); + if (fname.FileExists()) { + pano.setImageFilename(i, (const char *)fname.GetFullPath().mb_str()); + DEBUG_TRACE("New filename set: " << fname.GetFullPath().mb_str()); + // TODO - set pano dirty flag so that new paths are saved + continue; + } + } - wxMessageBox(wxString::Format(_("Image file not found:\n%s\nPlease select correct image"), fname.GetFullPath().c_str()), _("Image file not found")); + wxMessageBox(wxString::Format(_("Image file not found:\n%s\nPlease select correct image"), fname.GetFullPath().c_str()), _("Image file not found")); if (basedir == wxT("")) { basedir = fname.GetPath(); @@ -194,6 +194,15 @@ } fname.Assign(dlg.GetPath()); } + // check if image size is correct + SrcPanoImage srcImg = pano.getSrcImage(i); + // + vigra::ImageImportInfo imginfo(srcImg.getFilename().c_str()); + if (srcImg.getSize() != imginfo.size()) { + // adjust size properly. + srcImg.resize(imginfo.size()); + pano.setSrcImg(i, srcImg); + } // check if script contains invalid HFOV unsigned lNr = pano.getImage(i).getLensNr(); Lens cLens = pano.getLens(lNr); |