43 wxXmlResource::Get()->LoadDialog(
this, parent, wxT(
"image_variables_dialog"));
45 wxConfigBase * cfg = wxConfigBase::Get();
47 int x = cfg->Read(wxT(
"/ImageVariablesDialog/positionX"),-1l);
48 int y = cfg->Read(wxT(
"/ImageVariablesDialog/positionY"),-1l);
49 if ( y >= 0 && x >= 0)
72 wxConfigBase * cfg = wxConfigBase::Get();
73 wxPoint ps = this->GetPosition();
74 cfg->Write(wxT(
"/ImageVariablesDialog/positionX"), ps.x);
75 cfg->Write(wxT(
"/ImageVariablesDialog/positionY"), ps.y);
81 XRCCTRL(*
this,
"image_variable_notebook", wxNotebook)->SetSelection(i);
88 wxXmlResource::GetXRCID(
89 wxString(wxT(
"image_variable_")).append(wxString(varname, wxConvLocal)).c_str()
104 for (HuginBase::UIntSet::const_iterator it =
m_images.begin(); it !=
m_images.end() && identical; ++it)
106 identical=(responseType==
m_pano->
getImage(*it).getResponseType());
110 XRCCTRL(*
this,
"image_variable_responseType", wxChoice)->SetSelection(responseType);
113 int degDigits = wxConfigBase::Get()->Read(wxT(
"/General/DegreeFractionalDigitsEdit"),3);
114 int pixelDigits = wxConfigBase::Get()->Read(wxT(
"/General/PixelFractionalDigitsEdit"),2);
115 int distDigitsEdit = wxConfigBase::Get()->Read(wxT(
"/General/DistortionFractionalDigitsEdit"),5);
119 for (
const char** varname =
m_varNames; *varname != 0; ++varname)
122 int ndigits = distDigitsEdit;
123 if (strcmp(*varname,
"y") == 0 || strcmp(*varname,
"p") == 0 ||
124 strcmp(*varname,
"r") == 0 || strcmp(*varname,
"TrX") == 0 ||
125 strcmp(*varname,
"TrY") == 0 || strcmp(*varname,
"TrZ") == 0 )
129 if (strcmp(*varname,
"v") == 0 || strcmp(*varname,
"d") == 0 ||
130 strcmp(*varname,
"e") == 0 )
132 ndigits = pixelDigits;
136 for(HuginBase::UIntSet::const_iterator it=
m_images.begin();it!=
m_images.end() && identical;++it)
138 identical=(val==
const_map_get(imgVarVector[*it],*varname).getValue());
145 wxCommandEvent dummy;
152 XRCCTRL(*
this,
"image_variable_text_translation", wxStaticText)->Show(newLevel==
GUI_EXPERT);
153 XRCCTRL(*
this,
"image_variable_text_translation_x", wxStaticText)->Show(newLevel==
GUI_EXPERT);
154 XRCCTRL(*
this,
"image_variable_text_translation_y", wxStaticText)->Show(newLevel==
GUI_EXPERT);
155 XRCCTRL(*
this,
"image_variable_text_translation_z", wxStaticText)->Show(newLevel==
GUI_EXPERT);
156 XRCCTRL(*
this,
"image_variable_text_translation_Tpy", wxStaticText)->Show(newLevel==
GUI_EXPERT);
157 XRCCTRL(*
this,
"image_variable_text_translation_Tpp", wxStaticText)->Show(newLevel==
GUI_EXPERT);
158 XRCCTRL(*
this,
"image_variable_TrX", wxTextCtrl)->Show(newLevel==
GUI_EXPERT);
159 XRCCTRL(*
this,
"image_variable_TrY", wxTextCtrl)->Show(newLevel==
GUI_EXPERT);
160 XRCCTRL(*
this,
"image_variable_TrZ", wxTextCtrl)->Show(newLevel==
GUI_EXPERT);
161 XRCCTRL(*
this,
"image_variable_Tpy", wxTextCtrl)->Show(newLevel==
GUI_EXPERT);
162 XRCCTRL(*
this,
"image_variable_Tpp", wxTextCtrl)->Show(newLevel==
GUI_EXPERT);
164 XRCCTRL(*
this,
"image_variable_text_shear", wxStaticText)->Show(newLevel==
GUI_EXPERT);
165 XRCCTRL(*
this,
"image_variable_text_shear_g", wxStaticText)->Show(newLevel==
GUI_EXPERT);
166 XRCCTRL(*
this,
"image_variable_text_shear_t", wxStaticText)->Show(newLevel==
GUI_EXPERT);
167 XRCCTRL(*
this,
"image_variable_g", wxTextCtrl)->Show(newLevel==
GUI_EXPERT);
168 XRCCTRL(*
this,
"image_variable_t", wxTextCtrl)->Show(newLevel==
GUI_EXPERT);
173 std::vector<PanoCommand::PanoCommand*> commands;
175 for (
const char** varname =
m_varNames; *varname != 0; ++varname)
183 if(strcmp(*varname,
"v")==0)
187 wxMessageBox(_(
"The horizontal field of view must be positive."),
193 wxICON_EXCLAMATION | wxOK);
208 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),
214 wxICON_EXCLAMATION | wxYES_NO)==wxNO)
224 varMap.insert(std::make_pair(std::string(*varname),
HuginBase::Variable(std::string(*varname), val)));
228 wxLogError(_(
"Value must be numeric."));
233 int sel=XRCCTRL(*
this,
"image_variable_responseType", wxChoice)->GetSelection();
236 std::vector<HuginBase::SrcPanoImage> SrcImgs;
237 for (HuginBase::UIntSet::const_iterator it=
m_images.begin(); it!=
m_images.end(); ++it)
241 SrcImgs.push_back(img);
247 for(HuginBase::UIntSet::const_iterator it=
m_images.begin();it!=
m_images.end();++it)
254 if(!commands.empty())
276 switch(XRCCTRL(*
this,
"image_variable_notebook", wxNotebook)->GetSelection())
296 const bool showResponseParam = XRCCTRL(*
this,
"image_variable_responseType", wxChoice)->GetSelection() == 0;
297 wxTextCtrl* control = XRCCTRL(*
this,
"image_variable_Ra", wxTextCtrl);
298 control->Enable(showResponseParam);
299 control->Show(showResponseParam);
300 control = XRCCTRL(*
this,
"image_variable_Rb", wxTextCtrl);
301 control->Enable(showResponseParam);
302 control->Show(showResponseParam);
303 control = XRCCTRL(*
this,
"image_variable_Rc", wxTextCtrl);
304 control->Enable(showResponseParam);
305 control->Show(showResponseParam);
306 control = XRCCTRL(*
this,
"image_variable_Rd", wxTextCtrl);
307 control->Enable(showResponseParam);
308 control->Show(showResponseParam);
309 control = XRCCTRL(*
this,
"image_variable_Re", wxTextCtrl);
310 control->Enable(showResponseParam);
311 control->Show(showResponseParam);
315 "v",
"a",
"b",
"c",
"d",
"e",
"g",
"t",
317 "Vb",
"Vc",
"Vd",
"Vx",
"Vy",
318 "Ra",
"Rb",
"Rc",
"Rd",
"Re", 0};
325 if(stringa.empty() || stringb.empty() || stringc.empty())
330 std::vector<double> radialDist(4 ,0);
336 radialDist[3] = 1 - radialDist[0] - radialDist[1] - radialDist[2];
343 srcImage.setRadialDistortion(radialDist);
348 wxWindow *button = (wxWindow*) e.GetEventObject();
349 wxPoint pos=button->ClientToScreen(wxPoint(0,0));
350 m_popup->Position(pos, button->GetSize());
359 if(stringVb.empty() || stringVc.empty() || stringVd.empty())
364 std::vector<double> vigCorr(4,0);
379 srcImage.setRadialVigCorrCoeff(vigCorr);
386 std::vector<hugin_utils::FDiff2D> points;
392 graph.
DrawLine(points, wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT), 2);
396 wxWindow *button = (wxWindow*) e.GetEventObject();
397 wxPoint pos=button->ClientToScreen(wxPoint(0,0));
398 m_popup->Position(pos, button->GetSize());
410 if(stringRa.empty() || stringRb.empty() || stringRc.empty() || stringRd.empty() || stringRe.empty())
415 double Ra, Rb, Rc, Rd, Re;
432 std::vector<float> emor(5, 0.0);
433 std::vector<double> outLutStd;
437 std::vector<hugin_utils::FDiff2D> points;
438 for(
size_t i=0; i<outLutStd.size(); i++)
442 graph.
DrawLine(points, wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT), 1);
451 std::vector<double> outLut;
455 for(
size_t i=0; i<outLut.size(); i++)
459 graph.
DrawLine(points, wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT), 2);
465 std::vector<hugin_utils::FDiff2D> points;
468 graph.
DrawLine(points, wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT), 2);
474 wxWindow *button = (wxWindow*) e.GetEventObject();
475 wxPoint pos=button->ClientToScreen(wxPoint(0,0));
476 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
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.
ImageVariableDialog(wxWindow *parent, HuginBase::Panorama *pano, HuginBase::UIntSet imgs)
Constructor, read from xrc ressource; restore last uses settings and position.
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
void InitValues()
copy the variables from Panorama to dialog