42 EVT_BUTTON(XRCID("image_show_distortion_graph"),
ImageVariableDialog::OnShowDistortionGraph)
43 EVT_BUTTON(XRCID("image_show_vignetting_graph"),
ImageVariableDialog::OnShowVignettingGraph)
52 wxXmlResource::Get()->LoadDialog(
this, parent, wxT(
"image_variables_dialog"));
55 wxIconBundle myIcons(
huginApp::Get()->GetXRCPath() + wxT(
"data/hugin.ico"),wxBITMAP_TYPE_ICO);
58 wxIcon myIcon(
huginApp::Get()->GetXRCPath() + wxT(
"data/hugin.png"),wxBITMAP_TYPE_PNG);
62 wxConfigBase * cfg = wxConfigBase::Get();
64 int x = cfg->Read(wxT(
"/ImageVariablesDialog/positionX"),-1l);
65 int y = cfg->Read(wxT(
"/ImageVariablesDialog/positionY"),-1l);
66 if ( y >= 0 && x >= 0)
82 wxConfigBase * cfg = wxConfigBase::Get();
83 wxPoint ps = this->GetPosition();
84 cfg->Write(wxT(
"/ImageVariablesDialog/positionX"), ps.x);
85 cfg->Write(wxT(
"/ImageVariablesDialog/positionY"), ps.y);
91 XRCCTRL(*
this,
"image_variable_notebook", wxNotebook)->SetSelection(i);
98 wxXmlResource::GetXRCID(
99 wxString(wxT(
"image_variable_")).append(wxString(varname, wxConvLocal)).c_str()
114 for (HuginBase::UIntSet::const_iterator it =
m_images.begin(); it !=
m_images.end() && identical; ++it)
116 identical=(responseType==
m_pano->
getImage(*it).getResponseType());
120 XRCCTRL(*
this,
"image_variable_responseType", wxChoice)->SetSelection(responseType);
123 int degDigits = wxConfigBase::Get()->Read(wxT(
"/General/DegreeFractionalDigitsEdit"),3);
124 int pixelDigits = wxConfigBase::Get()->Read(wxT(
"/General/PixelFractionalDigitsEdit"),2);
125 int distDigitsEdit = wxConfigBase::Get()->Read(wxT(
"/General/DistortionFractionalDigitsEdit"),5);
129 for (
const char** varname =
m_varNames; *varname != 0; ++varname)
132 int ndigits = distDigitsEdit;
133 if (strcmp(*varname,
"y") == 0 || strcmp(*varname,
"p") == 0 ||
134 strcmp(*varname,
"r") == 0 || strcmp(*varname,
"TrX") == 0 ||
135 strcmp(*varname,
"TrY") == 0 || strcmp(*varname,
"TrZ") == 0 )
139 if (strcmp(*varname,
"v") == 0 || strcmp(*varname,
"d") == 0 ||
140 strcmp(*varname,
"e") == 0 )
142 ndigits = pixelDigits;
146 for(HuginBase::UIntSet::const_iterator it=
m_images.begin();it!=
m_images.end() && identical;++it)
148 identical=(val==
const_map_get(imgVarVector[*it],*varname).getValue());
155 wxCommandEvent dummy;
162 XRCCTRL(*
this,
"image_variable_text_translation", wxStaticText)->Show(newLevel==
GUI_EXPERT);
163 XRCCTRL(*
this,
"image_variable_text_translation_x", wxStaticText)->Show(newLevel==
GUI_EXPERT);
164 XRCCTRL(*
this,
"image_variable_text_translation_y", wxStaticText)->Show(newLevel==
GUI_EXPERT);
165 XRCCTRL(*
this,
"image_variable_text_translation_z", wxStaticText)->Show(newLevel==
GUI_EXPERT);
166 XRCCTRL(*
this,
"image_variable_text_translation_Tpy", wxStaticText)->Show(newLevel==
GUI_EXPERT);
167 XRCCTRL(*
this,
"image_variable_text_translation_Tpp", wxStaticText)->Show(newLevel==
GUI_EXPERT);
168 XRCCTRL(*
this,
"image_variable_TrX", wxTextCtrl)->Show(newLevel==
GUI_EXPERT);
169 XRCCTRL(*
this,
"image_variable_TrY", wxTextCtrl)->Show(newLevel==
GUI_EXPERT);
170 XRCCTRL(*
this,
"image_variable_TrZ", wxTextCtrl)->Show(newLevel==
GUI_EXPERT);
171 XRCCTRL(*
this,
"image_variable_Tpy", wxTextCtrl)->Show(newLevel==
GUI_EXPERT);
172 XRCCTRL(*
this,
"image_variable_Tpp", wxTextCtrl)->Show(newLevel==
GUI_EXPERT);
174 XRCCTRL(*
this,
"image_variable_text_shear", wxStaticText)->Show(newLevel==
GUI_EXPERT);
175 XRCCTRL(*
this,
"image_variable_text_shear_g", wxStaticText)->Show(newLevel==
GUI_EXPERT);
176 XRCCTRL(*
this,
"image_variable_text_shear_t", wxStaticText)->Show(newLevel==
GUI_EXPERT);
177 XRCCTRL(*
this,
"image_variable_g", wxTextCtrl)->Show(newLevel==
GUI_EXPERT);
178 XRCCTRL(*
this,
"image_variable_t", wxTextCtrl)->Show(newLevel==
GUI_EXPERT);
183 std::vector<PanoCommand::PanoCommand*> commands;
185 for (
const char** varname =
m_varNames; *varname != 0; ++varname)
193 if(strcmp(*varname,
"v")==0)
197 wxMessageBox(_(
"The horizontal field of view must be positive."),
203 wxICON_EXCLAMATION | wxOK);
218 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?"), val),
224 wxICON_EXCLAMATION | wxYES_NO)==wxNO)
234 varMap.insert(std::make_pair(std::string(*varname),
HuginBase::Variable(std::string(*varname), val)));
238 wxLogError(_(
"Value must be numeric."));
243 int sel=XRCCTRL(*
this,
"image_variable_responseType", wxChoice)->GetSelection();
246 std::vector<HuginBase::SrcPanoImage> SrcImgs;
247 for (HuginBase::UIntSet::const_iterator it=
m_images.begin(); it!=
m_images.end(); ++it)
251 SrcImgs.push_back(img);
257 for(HuginBase::UIntSet::const_iterator it=
m_images.begin();it!=
m_images.end();++it)
264 if(!commands.empty())
286 switch(XRCCTRL(*
this,
"image_variable_notebook", wxNotebook)->GetSelection())
306 const bool showResponseParam = XRCCTRL(*
this,
"image_variable_responseType", wxChoice)->GetSelection() == 0;
307 wxTextCtrl* control = XRCCTRL(*
this,
"image_variable_Ra", wxTextCtrl);
308 control->Enable(showResponseParam);
309 control->Show(showResponseParam);
310 control = XRCCTRL(*
this,
"image_variable_Rb", wxTextCtrl);
311 control->Enable(showResponseParam);
312 control->Show(showResponseParam);
313 control = XRCCTRL(*
this,
"image_variable_Rc", wxTextCtrl);
314 control->Enable(showResponseParam);
315 control->Show(showResponseParam);
316 control = XRCCTRL(*
this,
"image_variable_Rd", wxTextCtrl);
317 control->Enable(showResponseParam);
318 control->Show(showResponseParam);
319 control = XRCCTRL(*
this,
"image_variable_Re", wxTextCtrl);
320 control->Enable(showResponseParam);
321 control->Show(showResponseParam);
325 "v",
"a",
"b",
"c",
"d",
"e",
"g",
"t",
327 "Vb",
"Vc",
"Vd",
"Vx",
"Vy",
328 "Ra",
"Rb",
"Rc",
"Rd",
"Re", 0};
335 if(stringa.empty() || stringb.empty() || stringc.empty())
340 std::vector<double> radialDist(4 ,0);
346 radialDist[3] = 1 - radialDist[0] - radialDist[1] - radialDist[2];
353 srcImage.setRadialDistortion(radialDist);
358 wxWindow *button = (wxWindow*) e.GetEventObject();
359 wxPoint pos=button->ClientToScreen(wxPoint(0,0));
360 m_popup->Position(pos, button->GetSize());
369 if(stringVb.empty() || stringVc.empty() || stringVd.empty())
374 std::vector<double> vigCorr(4,0);
389 srcImage.setRadialVigCorrCoeff(vigCorr);
396 std::vector<hugin_utils::FDiff2D> points;
402 graph.
DrawLine(points, wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT), 2);
406 wxWindow *button = (wxWindow*) e.GetEventObject();
407 wxPoint pos=button->ClientToScreen(wxPoint(0,0));
408 m_popup->Position(pos, button->GetSize());
420 if(stringRa.empty() || stringRb.empty() || stringRc.empty() || stringRd.empty() || stringRe.empty())
425 double Ra, Rb, Rc, Rd, Re;
442 std::vector<float> emor(5, 0.0);
443 std::vector<double> outLutStd;
447 std::vector<hugin_utils::FDiff2D> points;
448 for(
size_t i=0; i<outLutStd.size(); i++)
452 graph.
DrawLine(points, wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT), 1);
461 std::vector<double> outLut;
465 for(
size_t i=0; i<outLut.size(); i++)
469 graph.
DrawLine(points, wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT), 2);
475 std::vector<hugin_utils::FDiff2D> points;
478 graph.
DrawLine(points, wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT), 2);
484 wxWindow *button = (wxWindow*) e.GetEventObject();
485 wxPoint pos=button->ClientToScreen(wxPoint(0,0));
486 m_popup->Position(pos, button->GetSize());
void DisplayHelp(wxString section=wxEmptyString)
call help browser with given file
void OnShowDistortionGraph(wxCommandEvent &e)
shows a popup with distortion graph
bool str2double(const wxString &s, double &d)
SrcPanoImage getSrcImage(unsigned imgNr) const
get a description of a source image
void SetGuiLevel(GuiLevel newLevel)
sets the GuiLevel
void OnShowVignettingGraph(wxCommandEvent &e)
shows a popup with vignetting graph
void enforceMonotonicity(LUT &lut)
enforce monotonicity of an array (mostly used for lookup tables)
wxString doubleTowxString(double d, int digits)
void SelectTab(size_t i)
selects the tab with index i
a variable has a value and a name.
include file for the hugin project
update variables of a single image
vigra::pair< typename ROIImage< Image, Mask >::image_const_traverser, typename ROIImage< Image, Mask >::ImageConstAccessor > srcImage(const ROIImage< Image, Mask > &img)
const Map::mapped_type & const_map_get(const Map &m, const typename Map::key_type &key)
void OnResponseSelected(wxCommandEvent &e)
response type changed
static huginApp * Get()
hack.. kind of a pseudo singleton...
PanoCommand to combine other PanoCommands.
std::set< unsigned int > UIntSet
std::vector< VariableMap > VariableMapVector
empirical model of response
wxGraphTools::GraphPopupWindow * m_popup
VariableMapVector getVariables() const
get variables of this panorama
Definition of dialog to edit image variables.
void OnHelp(wxCommandEvent &e)
shows the help
static MainFrame * Get()
hack.. kind of a pseudo singleton...
wxTextCtrl * GetImageVariableControl(const wxWindow *parent, const char *varname)
bool ApplyNewVariables()
applies the changed variables to the Panorama class, using CommandHistory
static GlobalCmdHist & getInstance()
void OnOk(wxCommandEvent &e)
Saves current state of all checkboxes when closing dialog with Ok.
void addCommand(PanoCommand *command, bool execute=true)
Adds a command to the history.
void createEMoRLUT(const std::vector< float > ¶ms, VECTOR &lut)
std::map< std::string, Variable > VariableMap
~ImageVariableDialog()
destructor, saves position
void OnShowResponseGraph(wxCommandEvent &e)
shows a popup with response graph
void setSize(vigra::Size2D val)
Set the image size in pixels.
const SrcPanoImage & getImage(std::size_t nr) const
get a panorama image, counting starts with 0
static const char * m_varNames[]
All variables of a source image.
HuginBase::UIntSet m_images
HuginBase::Panorama * m_pano
Dialog for editing image variables.
void InitValues()
copy the variables from Panorama to dialog