Hugintrunk  0.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
wxLensDB.cpp
Go to the documentation of this file.
1 // -*- c-basic-offset: 4 -*-
10 /* This program is free software; you can redistribute it and/or
11  * modify it under the terms of the GNU General Public
12  * License as published by the Free Software Foundation; either
13  * version 2 of the License, or (at your option) any later version.
14  *
15  * This software is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18  * General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public
21  * License along with this software. If not, see
22  * <http://www.gnu.org/licenses/>.
23  *
24  */
25 
26 #include "panoinc_WX.h"
27 #include "panoinc.h"
28 #include "wxLensDB.h"
29 #include "lensdb/LensDB.h"
30 #include "platform.h"
31 #include "base_wx/wxPlatform.h"
34 #include "base_wx/PanoCommand.h"
35 #include <set>
36 #include "base_wx/wxutils.h"
37 
39 class LoadLensDBDialog : public wxDialog
40 {
41 public:
43  explicit LoadLensDBDialog(wxWindow *parent);
44  void SetLensName(std::string lensname);
45  std::string GetLensName() const;
46  void SetFocalLength(double focal);
47  double GetFocalLength() const;
48  void SetAperture(double aperture);
49  double GetAperture() const;
50  void SetSubjectDistance(double distance);
51  double GetSubjectDistance() const;
52  bool GetLoadDistortion() const;
53  bool GetLoadVignetting() const;
54 
55 protected:
57  void OnOk(wxCommandEvent & e);
58  void OnCheckChanged(wxCommandEvent & e);
59 
60 private:
61  void FillLensList();
62  wxChoice *m_lenslist;
63  wxCheckBox *m_loadDistortion;
64  wxCheckBox *m_loadVignetting;
65  double m_focal{ 0 };
66  double m_aperture{ 0 };
67  double m_distance{ 0 };
69 };
70 
72 {
73  // load our children. some children might need special
74  // initialization. this will be done later.
75  wxXmlResource::Get()->LoadDialog(this, parent, "load_lens_dlg");
76 
77  //set parameters
78  wxConfigBase * config = wxConfigBase::Get();
79  // get display size
80  hugin_utils::RestoreFramePosition(this, "LoadLensDialog", true);
81  bool b;
82  config->Read("/LoadLensDialog/loadDistortion", &b, true);
83  m_loadDistortion = XRCCTRL(*this, "load_lens_distortion", wxCheckBox);
84  m_loadDistortion->SetValue(b);
85  m_loadDistortion->Bind(wxEVT_CHECKBOX, &LoadLensDBDialog::OnCheckChanged, this);
86  config->Read("/LoadLensDialog/loadVignetting", &b, true);
87  m_loadVignetting = XRCCTRL(*this, "load_lens_vignetting", wxCheckBox);
88  m_loadVignetting->SetValue(b);
89  m_loadVignetting->Bind(wxEVT_CHECKBOX, &LoadLensDBDialog::OnCheckChanged, this);
90  m_lenslist=XRCCTRL(*this,"load_lens_lenschoice", wxChoice);
91  FillLensList();
92  m_lenslist->Bind(wxEVT_CHOICE, &LoadLensDBDialog::OnCheckChanged, this);
93  Bind(wxEVT_BUTTON, &LoadLensDBDialog::OnOk, this, wxID_OK);
94 };
95 
97 {
98  if (HuginBase::LensDB::LensDB::GetSingleton().GetLensNames(true, true, false, m_lensNames))
99  {
100  wxArrayString lensnames;
101  for (HuginBase::LensDB::LensList::const_iterator it = m_lensNames.begin(); it != m_lensNames.end(); ++it)
102  {
103  wxString s((*it).c_str(), wxConvLocal);
104  wxString cam = s.AfterFirst('|');
105  if (!cam.empty())
106  {
107  s = wxString::Format(_("Camera %s (%s)"), cam.c_str(), s.BeforeFirst('|').c_str());
108  };
109  lensnames.Add(s);
110  };
111  m_lenslist->Append(lensnames);
112  };
113 };
114 
115 void LoadLensDBDialog::SetLensName(std::string lensname)
116 {
117  if (!lensname.empty() && !m_lensNames.empty())
118  {
119  HuginBase::LensDB::LensList::const_iterator it=std::find(m_lensNames.begin(), m_lensNames.end(), lensname);
120  if (it != m_lensNames.end())
121  {
122  m_lenslist->SetSelection(it - m_lensNames.begin());
123  };
124  };
125  wxCommandEvent dummy;
126  OnCheckChanged(dummy);
127 };
128 
129 std::string LoadLensDBDialog::GetLensName() const
130 {
131  return m_lensNames[m_lenslist->GetSelection()];
132 };
133 
135 {
136  m_focal=focal;
137  XRCCTRL(*this,"load_lens_focallength",wxTextCtrl)->SetValue(hugin_utils::doubleTowxString(m_focal,1));
138 };
139 
141 {
142  return m_focal;
143 };
144 
145 void LoadLensDBDialog::SetAperture(double aperture)
146 {
147  m_aperture=aperture;
148  XRCCTRL(*this,"load_lens_aperture",wxTextCtrl)->SetValue(hugin_utils::doubleTowxString(m_aperture,1));
149 };
150 
152 {
153  return m_aperture;
154 };
155 
157 {
158  m_distance=distance;
159  XRCCTRL(*this,"load_lens_distance",wxTextCtrl)->SetValue(hugin_utils::doubleTowxString(m_distance,0));
160 };
161 
163 {
164  return m_distance;
165 };
166 
168 {
169  return m_loadDistortion->GetValue();
170 };
171 
173 {
174  return m_loadVignetting->GetValue();
175 };
176 
177 // utility functions
178 bool str2double(wxWindow* parent, wxString s, double & d)
179 {
180  if (!hugin_utils::stringToDouble(std::string(s.mb_str(wxConvLocal)), d))
181  {
182  hugin_utils::HuginMessageBox(wxString::Format(_("The input \"%s\" is not a valid number."), s), _("Hugin"), wxOK | wxICON_ERROR, parent);
183  return false;
184  }
185  return true;
186 }
187 
188 void LoadLensDBDialog::OnOk(wxCommandEvent & e)
189 {
190  if(!m_loadDistortion->GetValue() && !m_loadVignetting->GetValue())
191  {
192  return;
193  };
194  if(m_lenslist->GetSelection()==wxNOT_FOUND)
195  {
196  wxBell();
197  return;
198  };
199  if(!str2double(this,XRCCTRL(*this,"load_lens_focallength",wxTextCtrl)->GetValue(),m_focal))
200  {
201  return;
202  };
203  if(m_loadVignetting->GetValue())
204  {
205  wxString val = XRCCTRL(*this, "load_lens_aperture", wxTextCtrl)->GetValue().Trim();
206  if (val.empty())
207  {
208  m_aperture = 0;
209  }
210  else
211  {
212  if (!str2double(this, val, m_aperture))
213  {
214  return;
215  };
216  };
217  val = XRCCTRL(*this, "load_lens_distance", wxTextCtrl)->GetValue().Trim();
218  if (val.empty())
219  {
220  m_distance = 0;
221  }
222  else
223  {
224  if (!str2double(this, val, m_distance))
225  {
226  return;
227  };
228  };
229  };
230  //store selected options
231  hugin_utils::StoreFramePosition(this, "LoadLensDialog", true);
232  wxConfigBase * config = wxConfigBase::Get();
233  config->Write("/LoadLensDialog/loadDistortion",m_loadDistortion->GetValue());
234  config->Write("/LoadLensDialog/loadVignetting",m_loadVignetting->GetValue());
235  config->Flush();
236  e.Skip();
237 };
238 
239 void LoadLensDBDialog::OnCheckChanged(wxCommandEvent & e)
240 {
241  const int sel = m_lenslist->GetSelection();
242  XRCCTRL(*this,"wxID_OK",wxButton)->Enable(sel!=wxNOT_FOUND && (m_loadDistortion->GetValue() || m_loadVignetting->GetValue()));
243 };
244 
246 {
247  LoadLensDBDialog dlg(parent);
248  const HuginBase::SrcPanoImage & img=pano->getImage(*images.begin());
249  dlg.SetLensName(img.getDBLensName());
250  dlg.SetFocalLength(img.getExifFocalLength());
251  dlg.SetAperture(img.getExifAperture());
252  dlg.SetSubjectDistance(img.getExifDistance());
253  if(dlg.ShowModal()==wxID_OK)
254  {
256  const double focal=dlg.GetFocalLength();
257  const std::string lensname = dlg.GetLensName();
258  std::vector<PanoCommand::PanoCommand*> cmds;
260  if(lensDB.GetProjection(lensname, proj))
261  {
262  cmds.push_back(new PanoCommand::ChangeImageProjectionCmd(*pano,images,proj));
263  };
264  vigra::Rect2D cropRect;
265  if(lensDB.GetCrop(lensname, focal, img.getSize(), cropRect))
266  {
267  cmds.push_back(new PanoCommand::ChangeImageCropModeCmd(*pano, images, img.isCircularCrop() ? HuginBase::BaseSrcPanoImage::CROP_CIRCLE : HuginBase::BaseSrcPanoImage::CROP_RECTANGLE));
268  cmds.push_back(new PanoCommand::ChangeImageCropRectCmd(*pano, images, cropRect));
269  };
270  //load lens distortion from database
271  if(dlg.GetLoadDistortion())
272  {
273  double hfov;
274  if (lensDB.GetFov(lensname, focal, hfov))
275  {
276  // calculate FOV for given image, take different aspect ratios into account
277  const double newFocal = HuginBase::SrcPanoImage::calcFocalLength(img.getProjection(), hfov, img.getCropFactor(), vigra::Size2D(3000, 2000));
278  const double newFov = HuginBase::SrcPanoImage::calcHFOV(img.getProjection(), newFocal, img.getCropFactor(), img.getSize());
279  std::set<HuginBase::ImageVariableGroup::ImageVariableEnum> linkedVariables;
280  linkedVariables.insert(HuginBase::ImageVariableGroup::IVE_HFOV);
281  cmds.push_back(new PanoCommand::ChangePartImagesLinkingCmd(*pano, images, linkedVariables,
283  cmds.push_back(new PanoCommand::ChangeImageHFOVCmd(*pano, images, newFov));
284  };
285  std::vector<double> dist;
286  if(lensDB.GetDistortion(lensname, focal, dist))
287  {
288  if (dist.size() == 3)
289  {
290  dist.push_back(1.0 - dist[0] - dist[1] - dist[2]);
291  std::set<HuginBase::ImageVariableGroup::ImageVariableEnum> linkedVariables;
292  linkedVariables.insert(HuginBase::ImageVariableGroup::IVE_RadialDistortion);
293  cmds.push_back(new PanoCommand::ChangePartImagesLinkingCmd(*pano, images, linkedVariables,
295  cmds.push_back(new PanoCommand::ChangeImageRadialDistortionCmd(*pano, images, dist));
296  };
297  };
298  };
299  if(dlg.GetLoadVignetting())
300  {
301  std::vector<double> vig;
302  if (lensDB.GetVignetting(lensname, focal, dlg.GetAperture(), dlg.GetSubjectDistance(), vig))
303  {
304  if (vig.size() == 4)
305  {
306  std::set<HuginBase::ImageVariableGroup::ImageVariableEnum> linkedVariables;
307  linkedVariables.insert(HuginBase::ImageVariableGroup::IVE_RadialVigCorrCoeff);
308  cmds.push_back(new PanoCommand::ChangePartImagesLinkingCmd(*pano, images, linkedVariables,
310  cmds.push_back(new PanoCommand::ChangeImageRadialVigCorrCoeffCmd(*pano, images, vig));
311  };
312  };
313  };
314  cmd=new PanoCommand::CombinedPanoCommand(*pano, cmds);
315  return true;
316  };
317  return false;
318 };
319 
321 class SaveLensDBDialog : public wxDialog
322 {
323 public:
325  explicit SaveLensDBDialog(wxWindow *parent);
326  void SetCameraMaker(std::string maker);
327  std::string GetCameraMaker() const;
328  void SetCameraModel(std::string model);
329  std::string GetCameraModel() const;
330  void SetLensName(std::string lensname);
331  std::string GetLensName() const;
332  std::string GetLensMaker() const;
333  void SetFocalLength(double focal);
334  double GetFocalLength() const;
335  void SetAperture(double aperture);
336  double GetAperture() const;
337  void SetSubjectDistance(double distance);
338  double GetSubjectDistance() const;
339  bool GetSaveDistortion() const;
340  bool GetSaveVignetting() const;
342 
343 protected:
345  void OnOk(wxCommandEvent & e);
346  void OnCheckChanged(wxCommandEvent & e);
347 
348 private:
349  wxCheckBox *m_saveDistortion;
350  wxCheckBox *m_saveVignetting;
351  double m_focal { 0 };
352  double m_aperture{ 0 };
353  double m_distance{ 0 };
354 };
355 
357 {
358  // load our children. some children might need special
359  // initialization. this will be done later.
360  wxXmlResource::Get()->LoadDialog(this, parent, "save_lens_dlg");
361 
362  //set parameters
363  wxConfigBase * config = wxConfigBase::Get();
364  hugin_utils::RestoreFramePosition(this, "SaveLensDialog", true);
365  bool b;
366  config->Read("/SaveLensDialog/saveDistortion",&b,true);
367  m_saveDistortion=XRCCTRL(*this,"save_lens_distortion",wxCheckBox);
368  m_saveDistortion->SetValue(b);
369  m_saveDistortion->Bind(wxEVT_CHECKBOX, &SaveLensDBDialog::OnCheckChanged, this);
370  config->Read("/SaveLensDialog/saveVignetting",&b,true);
371  m_saveVignetting=XRCCTRL(*this,"save_lens_vignetting",wxCheckBox);
372  m_saveVignetting->SetValue(b);
373  m_saveVignetting->Bind(wxEVT_CHECKBOX, &SaveLensDBDialog::OnCheckChanged, this);
374  Bind(wxEVT_BUTTON, &SaveLensDBDialog::OnOk, this, wxID_OK);
375 };
376 
377 void SaveLensDBDialog::SetCameraMaker(std::string maker)
378 {
379  if(!maker.empty())
380  {
381  XRCCTRL(*this,"save_lens_camera_maker",wxTextCtrl)->SetValue(wxString(maker.c_str(), wxConvLocal));
382  };
383 };
384 
386 {
387  return std::string(XRCCTRL(*this,"save_lens_camera_maker",wxTextCtrl)->GetValue().Trim().mb_str(wxConvLocal));
388 };
389 
390 void SaveLensDBDialog::SetCameraModel(std::string model)
391 {
392  if(!model.empty())
393  {
394  XRCCTRL(*this,"save_lens_camera_model",wxTextCtrl)->SetValue(wxString(model.c_str(), wxConvLocal));
395  };
396 };
397 
399 {
400  return std::string(XRCCTRL(*this,"save_lens_camera_model",wxTextCtrl)->GetValue().Trim().mb_str(wxConvLocal));
401 };
402 
403 void SaveLensDBDialog::SetLensName(std::string lensname)
404 {
405  if(!lensname.empty())
406  {
407  XRCCTRL(*this,"save_lens_name",wxTextCtrl)->SetValue(wxString(lensname.c_str(), wxConvLocal));
408  };
409 };
410 
411 std::string SaveLensDBDialog::GetLensName() const
412 {
413  return std::string(XRCCTRL(*this,"save_lens_name",wxTextCtrl)->GetValue().Trim().mb_str(wxConvLocal));
414 };
415 
417 {
418  return std::string(XRCCTRL(*this,"save_lens_maker",wxTextCtrl)->GetValue().Trim().mb_str(wxConvLocal));
419 };
420 
422 {
423  m_focal=focal;
424  XRCCTRL(*this,"save_lens_focallength",wxTextCtrl)->SetValue(hugin_utils::doubleTowxString(m_focal,1));
425 };
426 
428 {
429  return m_focal;
430 };
431 
432 void SaveLensDBDialog::SetAperture(double aperture)
433 {
434  m_aperture=aperture;
435  XRCCTRL(*this,"save_lens_aperture",wxTextCtrl)->SetValue(hugin_utils::doubleTowxString(m_aperture,1));
436 };
437 
439 {
440  return m_aperture;
441 };
442 
444 {
445  m_distance=distance;
446  XRCCTRL(*this,"save_lens_distance",wxTextCtrl)->SetValue(hugin_utils::doubleTowxString(m_distance,0));
447 };
448 
450 {
451  return m_distance;
452 };
453 
455 {
456  return m_saveDistortion->GetValue();
457 };
458 
460 {
461  return m_saveVignetting->GetValue();
462 };
463 
465 {
466  m_saveVignetting->SetValue(false);
467  m_saveVignetting->Disable();
468 };
469 
470 void SaveLensDBDialog::OnOk(wxCommandEvent & e)
471 {
472  if(!m_saveDistortion->GetValue() && !m_saveVignetting->GetValue())
473  {
474  return;
475  };
476  if(GetLensName().empty() && (GetCameraMaker().empty() || GetCameraModel().empty()))
477  {
478  hugin_utils::HuginMessageBox(_("There is too little information for saving data into database. Please check your input!"), _("Hugin"), wxOK | wxICON_ERROR, this);
479  return;
480  };
481  if(!str2double(this,XRCCTRL(*this,"save_lens_focallength",wxTextCtrl)->GetValue(),m_focal))
482  {
483  return;
484  };
485  if(m_saveVignetting->GetValue())
486  {
487  wxString val = XRCCTRL(*this, "save_lens_aperture", wxTextCtrl)->GetValue().Trim();
488  if (val.empty())
489  {
490  m_aperture = 0;
491  }
492  else
493  {
494  if (!str2double(this, val, m_aperture))
495  {
496  return;
497  };
498  };
499  val = XRCCTRL(*this, "save_lens_distance", wxTextCtrl)->GetValue().Trim();
500  if (val.empty())
501  {
502  m_distance = 0;
503  }
504  else
505  {
506  if (!str2double(this, val, m_distance))
507  {
508  return;
509  };
510  };
511  };
512  //store selected options
513  hugin_utils::StoreFramePosition(this, "SaveLensDialog", true);
514  wxConfigBase * config = wxConfigBase::Get();
515  config->Write("/SaveLensDialog/saveDistortion",m_saveDistortion->GetValue());
516  if(m_saveVignetting->IsEnabled())
517  {
518  config->Write("/SaveLensDialog/saveVignetting",m_saveVignetting->GetValue());
519  };
520  config->Flush();
521  e.Skip();
522 };
523 
524 void SaveLensDBDialog::OnCheckChanged(wxCommandEvent & e)
525 {
526  XRCCTRL(*this,"wxID_OK",wxButton)->Enable(m_saveDistortion->GetValue() || m_saveVignetting->GetValue());
527 };
528 
529 bool SaveLensParameters(wxWindow * parent, const HuginBase::SrcPanoImage& img, bool includeVignetting)
530 {
532  // show dialog
533  SaveLensDBDialog lensDlg(parent);
534  lensDlg.SetCameraMaker(img.getExifMake());
535  lensDlg.SetCameraModel(img.getExifModel());
536  lensDlg.SetLensName(img.getDBLensName());
537  lensDlg.SetFocalLength(img.getExifFocalLength());
538  lensDlg.SetAperture(img.getExifAperture());
539  lensDlg.SetSubjectDistance(img.getExifDistance());
540  if (!includeVignetting)
541  {
542  lensDlg.DeactivateSaveVignetting();
543  };
544  if (lensDlg.ShowModal() != wxID_OK)
545  {
546  return false;
547  };
548  const std::string camMaker = lensDlg.GetCameraMaker();
549  const std::string camModel = lensDlg.GetCameraModel();
550  std::string lensname = lensDlg.GetLensName();
551  const double focal = lensDlg.GetFocalLength();
552  if (lensname.empty())
553  {
554  //empty lensname, assuming it is a compact camera
555  lensname = camMaker + "|" + camModel;
556  };
557  // unknown crop factor, remember it
558  if (img.getExifCropFactor() < 0.1 && !camMaker.empty() && !camModel.empty())
559  {
560  lensDB.SaveCameraCrop(camMaker, camModel, img.getCropFactor());
561  };
562  if (lensDlg.GetSaveDistortion())
563  {
564  const double newFocallength = HuginBase::SrcPanoImage::calcFocalLength(img.getProjection(), img.getHFOV(), img.getCropFactor(), img.getSize());
565  const double newHFOV = HuginBase::SrcPanoImage::calcHFOV(img.getProjection(), newFocallength, img.getCropFactor(), vigra::Size2D(3000, 2000));
566  // save information with higher weight
567  if (!lensDB.SaveLensFov(lensname, lensDlg.GetFocalLength(), newHFOV, 75))
568  {
569  hugin_utils::HuginMessageBox(_("Could not save information into database."), _("Hugin"), wxOK | wxICON_ERROR, parent);
570  return false;
571  };
572  if (!lensDB.SaveDistortion(lensname, focal, img.getRadialDistortion(), 75))
573  {
574  hugin_utils::HuginMessageBox(_("Could not save information into database."), _("Hugin"), wxOK | wxICON_ERROR, parent);
575  return false;
576  };
577  };
578  if(lensDlg.GetSaveVignetting())
579  {
580  if (!lensDB.SaveVignetting(lensname, focal, lensDlg.GetAperture(), lensDlg.GetSubjectDistance(), img.getRadialVigCorrCoeff(), 75))
581  {
582  hugin_utils::HuginMessageBox(_("Could not save information into database."), _("Hugin"), wxOK | wxICON_ERROR, parent);
583  return false;
584  };
585  };
586  return true;
587 };
588 
wxCheckBox * m_saveDistortion
Definition: wxLensDB.cpp:349
Base class for all panorama commands.
Definition: Command.h:38
void SetSubjectDistance(double distance)
Definition: wxLensDB.cpp:156
void OnOk(wxCommandEvent &e)
Saves current state of all checkboxes when closing dialog with Ok.
Definition: wxLensDB.cpp:470
static const std::set< ConstImageVariableGroup::ImageVariableEnum > & getLensVariables()
Get the set of lens image variables.
implementation of huginApp Class
SaveLensDBDialog(wxWindow *parent)
Constructor, read from xrc ressource; restore last uses settings, size and position.
Definition: wxLensDB.cpp:356
bool GetLoadVignetting() const
Definition: wxLensDB.cpp:172
bool SaveVignetting(const std::string &lens, const double focal, const double aperture, const double distance, const std::vector< double > &vignetting, const int weight=10)
saves the vignetting parameters of the lens
Definition: LensDB.cpp:2490
double GetAperture() const
Definition: wxLensDB.cpp:438
void RestoreFramePosition(wxTopLevelWindow *frame, const wxString &basename, const bool ignoreMaximize)
Definition: wxutils.cpp:67
Change the linking of some variables across parts of an ImageVariableGroup containing some specified ...
Definition: PanoCommand.h:524
double GetFocalLength() const
Definition: wxLensDB.cpp:140
bool GetSaveVignetting() const
Definition: wxLensDB.cpp:459
void StoreFramePosition(wxTopLevelWindow *frame, const wxString &basename, const bool ignoreMaximize)
Definition: wxutils.cpp:106
static LensDB & GetSingleton()
returns the static LensDB instance
Definition: LensDB.cpp:2001
bool isCircularCrop() const
returns true, if projection requires cicular crop
bool ApplyLensDBParameters(wxWindow *parent, HuginBase::Panorama *pano, HuginBase::UIntSet images, PanoCommand::PanoCommand *&cmd)
loads the lens parameters from lens database and create approbiate PanoCommand::PanoCommand to apply ...
Definition: wxLensDB.cpp:245
bool GetVignetting(const std::string &lens, const double focal, const double aperture, const double distance, std::vector< double > &vignetting) const
returns the vignetting parameters of the lens
Definition: LensDB.cpp:2205
std::string getDBLensName() const
constructs the lens name for the database it is the lensname if known, for compact cameras it is cons...
bool GetProjection(const std::string &lens, BaseSrcPanoImage::Projection &projection) const
returns the projection of the lens
Definition: LensDB.cpp:2040
bool GetCrop(const std::string &lens, const double focal, const vigra::Size2D &imageSize, vigra::Rect2D &cropRect) const
returns the crop of the lens the information for landscape and portrait images are stored separately ...
Definition: LensDB.cpp:2073
void SetFocalLength(double focal)
Definition: wxLensDB.cpp:134
double GetSubjectDistance() const
Definition: wxLensDB.cpp:449
wxString doubleTowxString(double d, int digits)
Definition: wxPlatform.cpp:31
include file for the hugin project
HuginBase::LensDB::LensList m_lensNames
Definition: wxLensDB.cpp:68
Declare the ImageVariableGroup and ImageVariableGroupObserver classes.
bool GetDistortion(const std::string &lens, const double focal, std::vector< double > &distortion) const
returns the distortion parameters of the lens
Definition: LensDB.cpp:2162
dialog for saving lens parameter into lens database
Definition: wxLensDB.cpp:321
PanoCommand to combine other PanoCommands.
Definition: PanoCommand.h:39
std::string GetCameraMaker() const
Definition: wxLensDB.cpp:385
main database class
Definition: LensDB.h:44
dialog for loading lens parameter from lens database
Definition: wxLensDB.cpp:39
std::set< unsigned int > UIntSet
Definition: PanoramaData.h:51
bool SaveCameraCrop(const std::string &maker, const std::string &model, const double cropfactor)
save the camera with the given cropfactor into the database
Definition: LensDB.cpp:2429
class to access Hugins camera and lens database
Model for a panorama.
Definition: Panorama.h:152
double GetAperture() const
Definition: wxLensDB.cpp:151
void OnCheckChanged(wxCommandEvent &e)
Definition: wxLensDB.cpp:524
double GetSubjectDistance() const
Definition: wxLensDB.cpp:162
void SaveLensParameters(const wxString filename, HuginBase::Panorama *pano, unsigned int imgNr)
save the lens parameters of the image to a lens file named filename
Definition: LensTools.cpp:144
double m_distance
Definition: wxLensDB.cpp:67
void OnCheckChanged(wxCommandEvent &e)
Definition: wxLensDB.cpp:239
void SetAperture(double aperture)
Definition: wxLensDB.cpp:145
bool GetFov(const std::string &lens, const double focal, double &fov) const
returns the field of view of the lens the fov is always returned for a landscape image with aspect ra...
Definition: LensDB.cpp:2119
std::string GetLensName() const
Definition: wxLensDB.cpp:411
wxCheckBox * m_saveVignetting
Definition: wxLensDB.cpp:350
static double calcFocalLength(SrcPanoImage::Projection proj, double hfov, double crop, vigra::Size2D imageSize)
calcualte focal length, given crop factor and hfov
void SetFocalLength(double focal)
Definition: wxLensDB.cpp:421
bool stringToDouble(const STR &str_, double &dest)
convert a string to a double, ignore localisation.
Definition: utils.h:114
dialogs for loading and saving information from/to lens database
void OnOk(wxCommandEvent &e)
Saves current state of all checkboxes when closing dialog with Ok.
Definition: wxLensDB.cpp:188
bool GetSaveDistortion() const
Definition: wxLensDB.cpp:454
include file for the hugin project
Convenience functions for SrcPanoImage to use on the image variables.
void SetLensName(std::string lensname)
Definition: wxLensDB.cpp:115
void SetSubjectDistance(double distance)
Definition: wxLensDB.cpp:443
wxCheckBox * m_loadVignetting
Definition: wxLensDB.cpp:64
void DeactivateSaveVignetting()
Definition: wxLensDB.cpp:464
bool SaveDistortion(const std::string &lens, const double focal, const std::vector< double > &distortion, const int weight=10)
saves the distortion parameters of the lens in the database
Definition: LensDB.cpp:2481
std::vector< std::string > LensList
vector storing a list of lens names
Definition: LensDB.h:41
void SetCameraMaker(std::string maker)
Definition: wxLensDB.cpp:377
std::string GetCameraModel() const
Definition: wxLensDB.cpp:398
LoadLensDBDialog(wxWindow *parent)
Constructor, read from xrc ressource; restore last uses settings, size and position.
Definition: wxLensDB.cpp:71
static double calcHFOV(SrcPanoImage::Projection proj, double fl, double crop, vigra::Size2D imageSize)
calculate hfov of an image given focal length, image size and crop factor
platform/compiler specific stuff.
void FillLensList()
Definition: wxLensDB.cpp:96
std::string GetLensMaker() const
Definition: wxLensDB.cpp:416
void SetCameraModel(std::string model)
Definition: wxLensDB.cpp:390
const SrcPanoImage & getImage(std::size_t nr) const
get a panorama image, counting starts with 0
Definition: Panorama.h:211
void SetAperture(double aperture)
Definition: wxLensDB.cpp:432
All variables of a source image.
Definition: SrcPanoImage.h:194
bool SaveLensFov(const std::string &lens, const double focal, const double fov, const int weight=10)
saves the field of view of the lens the fov should always calculated for a landscape image with aspec...
Definition: LensDB.cpp:2472
double m_aperture
Definition: wxLensDB.cpp:66
void SetLensName(std::string lensname)
Definition: wxLensDB.cpp:403
int HuginMessageBox(const wxString &message, const wxString &caption, int style, wxWindow *parent)
Definition: wxutils.cpp:176
wxCheckBox * m_loadDistortion
Definition: wxLensDB.cpp:63
wxChoice * m_lenslist
Definition: wxLensDB.cpp:62
bool str2double(wxWindow *parent, wxString s, double &d)
Definition: wxLensDB.cpp:178
bool GetLoadDistortion() const
Definition: wxLensDB.cpp:167
double GetFocalLength() const
Definition: wxLensDB.cpp:427
std::string GetLensName() const
Definition: wxLensDB.cpp:129