28 #include "hugin_config.h"
38 EVT_CHOICE (XRCID("lensdlg_type_choice"),
HFOVDialog::OnTypeChanged)
39 EVT_TEXT ( XRCID("lensdlg_cropfactor_text"),
HFOVDialog::OnCropFactorChanged )
40 EVT_TEXT ( XRCID("lensdlg_hfov_text"),
HFOVDialog::OnHFOVChanged )
41 EVT_TEXT ( XRCID("lensdlg_focallength_text"),
HFOVDialog::OnFocalLengthChanged )
42 EVT_BUTTON( XRCID("lensdlg_load_lens_button"),
HFOVDialog::OnLoadLensParameters )
49 m_HFOV = srcImg.getHFOV();
50 m_focalLength = srcImg.getExifFocalLength();
51 m_cropFactor = srcImg.getCropFactor();
52 wxXmlResource::Get()->LoadDialog(
this, parent, wxT(
"dlg_focallength"));
54 m_cropText = XRCCTRL(*
this,
"lensdlg_cropfactor_text", wxTextCtrl);
57 m_hfovText = XRCCTRL(*
this,
"lensdlg_hfov_text", wxTextCtrl);
60 m_focalLengthText = XRCCTRL(*
this,
"lensdlg_focallength_text", wxTextCtrl);
63 m_projChoice = XRCCTRL(*
this,
"lensdlg_type_choice", wxChoice);
67 m_okButton = XRCCTRL(*
this,
"wxID_OK", wxButton);
73 message.Printf(_(
"No or only partial information about field of view was found in image file\n%s\n\nPlease enter the horizontal field of view (HFOV) or the focal length and crop factor."), fn.c_str());
74 XRCCTRL(*
this,
"lensdlg_message", wxStaticText)->SetLabel(message);
77 if (m_cropFactor > 0 && m_focalLength > 0) {
80 m_cropFactor, m_srcImg.getSize());
83 m_hfovText->SetValue(m_HFOVStr);
85 m_focalLengthText->SetValue(m_focalLengthStr);
87 m_cropText->SetValue(m_cropFactorStr);
88 }
else if (m_cropFactor > 0 && m_focalLength <= 0) {
91 m_cropText->SetValue(m_cropFactorStr);
92 m_okButton->Disable();
93 }
else if (m_cropFactor <= 0 && m_focalLength > 0) {
96 m_focalLengthText->SetValue(m_focalLengthStr);
97 m_okButton->Disable();
103 m_cropText->SetValue(m_cropFactorStr);
104 m_okButton->Disable();
107 this->GetSizer()->SetSizeHints(
this);
126 DEBUG_DEBUG(
"state: " <<
m_HFOVStr.mb_str(wxConvLocal) <<
", change:" << text.mb_str(wxConvLocal));
127 DEBUG_DEBUG(
"cmd str: " << e.GetString().mb_str(wxConvLocal));
155 wxMessageBox(_(
"The horizontal field of view must be positive."));
207 wxMessageBox(_(
"The focal length must be positive."));
247 wxMessageBox(_(
"The crop factor must be positive."));
269 bool autoCenterCrop=
false;
270 vigra::Rect2D cropRect;
283 std::vector<double> radialDist(4);
287 radialDist[3] = 1 - radialDist[0] - radialDist[1] - radialDist[2];
288 m_srcImg.setRadialDistortion(radialDist);
292 m_srcImg.setRadialDistortionCenterShift(t);
298 std::vector<double> vigCorrCoeff(4);
303 m_srcImg.setRadialVigCorrCoeff(vigCorrCoeff);
306 m_srcImg.setRadialVigCorrCenterShift(t);
308 std::vector<float> resp(5);
370 wxString::Format(_(
"You have given a field of view of %.2f degrees.\n But the orthographic projection is limited to a field of view of 180 degress.\nDo you want still use that high value?"),
m_HFOV),
376 wxICON_EXCLAMATION | wxYES_NO)==wxNO)
void OnFocalLengthChanged(wxCommandEvent &e)
void setCropMode(CropMode val)
Set the crop mode.
void setImageSize(const vigra::Size2D &sz)
set image size in pixels
bool str2double(const wxString &s, double &d)
bool isCircularCrop() const
returns true, if projection requires cicular crop
double getHFOV() const
get HFOV in degrees
wxString doubleTowxString(double d, int digits)
#define DEBUG_ASSERT(cond)
include file for the hugin project
void OnLoadLensParameters(wxCommandEvent &e)
const Map::mapped_type & const_map_get(const Map &m, const typename Map::key_type &key)
void OnTypeChanged(wxCommandEvent &e)
LensProjectionFormat getProjection() const
get projection type
wxTextCtrl * m_focalLengthText
void OnCropFactorChanged(wxCommandEvent &e)
void OnOk(wxCommandEvent &e)
wxString m_focalLengthStr
static double calcFocalLength(SrcPanoImage::Projection proj, double hfov, double crop, vigra::Size2D imageSize)
calcualte focal length, given crop factor and hfov
include file for the hugin project
HuginBase::SrcPanoImage m_srcImg
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
double getCropFactor() const
get crop factor, d35mm/dreal
HuginBase::SrcPanoImage GetSrcImage()
All variables of a source image.
void OnHFOVChanged(wxCommandEvent &e)