44 wxXmlResource::Get()->LoadDialog(
this, parent,
"image_variables_dialog");
46 wxConfigBase * cfg = wxConfigBase::Get();
48 int x = cfg->Read(
"/ImageVariablesDialog/positionX",-1l);
49 int y = cfg->Read(
"/ImageVariablesDialog/positionY",-1l);
50 if ( y >= 0 && x >= 0)
73 wxConfigBase * cfg = wxConfigBase::Get();
74 wxPoint ps = this->GetPosition();
75 cfg->Write(
"/ImageVariablesDialog/positionX", ps.x);
76 cfg->Write(
"/ImageVariablesDialog/positionY", ps.y);
82 XRCCTRL(*
this,
"image_variable_notebook", wxNotebook)->SetSelection(i);
89 wxXmlResource::GetXRCID(
90 wxString(
"image_variable_").append(wxString(varname, wxConvLocal)).c_str()
105 for (HuginBase::UIntSet::const_iterator it =
m_images.begin(); it !=
m_images.end() && identical; ++it)
107 identical=(responseType==
m_pano->
getImage(*it).getResponseType());
111 XRCCTRL(*
this,
"image_variable_responseType", wxChoice)->SetSelection(responseType);
114 int degDigits = wxConfigBase::Get()->Read(
"/General/DegreeFractionalDigitsEdit",3);
115 int pixelDigits = wxConfigBase::Get()->Read(
"/General/PixelFractionalDigitsEdit",2);
116 int distDigitsEdit = wxConfigBase::Get()->Read(
"/General/DistortionFractionalDigitsEdit",5);
120 for (
const char** varname =
m_varNames; *varname != 0; ++varname)
123 int ndigits = distDigitsEdit;
124 if (strcmp(*varname,
"y") == 0 || strcmp(*varname,
"p") == 0 ||
125 strcmp(*varname,
"r") == 0 || strcmp(*varname,
"TrX") == 0 ||
126 strcmp(*varname,
"TrY") == 0 || strcmp(*varname,
"TrZ") == 0 )
130 if (strcmp(*varname,
"v") == 0 || strcmp(*varname,
"d") == 0 ||
131 strcmp(*varname,
"e") == 0 )
133 ndigits = pixelDigits;
137 for(HuginBase::UIntSet::const_iterator it=
m_images.begin();it!=
m_images.end() && identical;++it)
139 identical=(val==
const_map_get(imgVarVector[*it],*varname).getValue());
146 wxCommandEvent dummy;
153 XRCCTRL(*
this,
"image_variable_text_translation", wxStaticText)->Show(newLevel==
GUI_EXPERT);
154 XRCCTRL(*
this,
"image_variable_text_translation_x", wxStaticText)->Show(newLevel==
GUI_EXPERT);
155 XRCCTRL(*
this,
"image_variable_text_translation_y", wxStaticText)->Show(newLevel==
GUI_EXPERT);
156 XRCCTRL(*
this,
"image_variable_text_translation_z", wxStaticText)->Show(newLevel==
GUI_EXPERT);
157 XRCCTRL(*
this,
"image_variable_text_translation_Tpy", wxStaticText)->Show(newLevel==
GUI_EXPERT);
158 XRCCTRL(*
this,
"image_variable_text_translation_Tpp", wxStaticText)->Show(newLevel==
GUI_EXPERT);
159 XRCCTRL(*
this,
"image_variable_TrX", wxTextCtrl)->Show(newLevel==
GUI_EXPERT);
160 XRCCTRL(*
this,
"image_variable_TrY", wxTextCtrl)->Show(newLevel==
GUI_EXPERT);
161 XRCCTRL(*
this,
"image_variable_TrZ", wxTextCtrl)->Show(newLevel==
GUI_EXPERT);
162 XRCCTRL(*
this,
"image_variable_Tpy", wxTextCtrl)->Show(newLevel==
GUI_EXPERT);
163 XRCCTRL(*
this,
"image_variable_Tpp", wxTextCtrl)->Show(newLevel==
GUI_EXPERT);
165 XRCCTRL(*
this,
"image_variable_text_shear", wxStaticText)->Show(newLevel==
GUI_EXPERT);
166 XRCCTRL(*
this,
"image_variable_text_shear_g", wxStaticText)->Show(newLevel==
GUI_EXPERT);
167 XRCCTRL(*
this,
"image_variable_text_shear_t", wxStaticText)->Show(newLevel==
GUI_EXPERT);
168 XRCCTRL(*
this,
"image_variable_g", wxTextCtrl)->Show(newLevel==
GUI_EXPERT);
169 XRCCTRL(*
this,
"image_variable_t", wxTextCtrl)->Show(newLevel==
GUI_EXPERT);
174 std::vector<PanoCommand::PanoCommand*> commands;
176 for (
const char** varname =
m_varNames; *varname != 0; ++varname)
184 if(strcmp(*varname,
"v")==0)
203 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),
204 _(
"Hugin"), wxICON_EXCLAMATION | wxYES_NO,
this) == wxNO)
214 varMap.insert(std::make_pair(std::string(*varname),
HuginBase::Variable(std::string(*varname), val)));
218 wxLogError(_(
"Value must be numeric."));
223 int sel=XRCCTRL(*
this,
"image_variable_responseType", wxChoice)->GetSelection();
226 std::vector<HuginBase::SrcPanoImage> SrcImgs;
227 for (HuginBase::UIntSet::const_iterator it=
m_images.begin(); it!=
m_images.end(); ++it)
231 SrcImgs.push_back(img);
237 for(HuginBase::UIntSet::const_iterator it=
m_images.begin();it!=
m_images.end();++it)
244 if(!commands.empty())
266 switch(XRCCTRL(*
this,
"image_variable_notebook", wxNotebook)->GetSelection())
286 const bool showResponseParam = XRCCTRL(*
this,
"image_variable_responseType", wxChoice)->GetSelection() == 0;
287 wxTextCtrl* control = XRCCTRL(*
this,
"image_variable_Ra", wxTextCtrl);
288 control->Enable(showResponseParam);
289 control->Show(showResponseParam);
290 control = XRCCTRL(*
this,
"image_variable_Rb", wxTextCtrl);
291 control->Enable(showResponseParam);
292 control->Show(showResponseParam);
293 control = XRCCTRL(*
this,
"image_variable_Rc", wxTextCtrl);
294 control->Enable(showResponseParam);
295 control->Show(showResponseParam);
296 control = XRCCTRL(*
this,
"image_variable_Rd", wxTextCtrl);
297 control->Enable(showResponseParam);
298 control->Show(showResponseParam);
299 control = XRCCTRL(*
this,
"image_variable_Re", wxTextCtrl);
300 control->Enable(showResponseParam);
301 control->Show(showResponseParam);
305 "v",
"a",
"b",
"c",
"d",
"e",
"g",
"t",
307 "Vb",
"Vc",
"Vd",
"Vx",
"Vy",
308 "Ra",
"Rb",
"Rc",
"Rd",
"Re", 0};
315 if(stringa.empty() || stringb.empty() || stringc.empty())
320 std::vector<double> radialDist(4 ,0);
326 radialDist[3] = 1 - radialDist[0] - radialDist[1] - radialDist[2];
333 srcImage.setRadialDistortion(radialDist);
338 wxWindow *button = (wxWindow*) e.GetEventObject();
339 wxPoint pos=button->ClientToScreen(wxPoint(0,0));
340 m_popup->Position(pos, button->GetSize());
349 if(stringVb.empty() || stringVc.empty() || stringVd.empty())
354 std::vector<double> vigCorr(4,0);
369 srcImage.setRadialVigCorrCoeff(vigCorr);
376 std::vector<hugin_utils::FDiff2D> points;
382 graph.
DrawLine(points, wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT), 2);
386 wxWindow *button = (wxWindow*) e.GetEventObject();
387 wxPoint pos=button->ClientToScreen(wxPoint(0,0));
388 m_popup->Position(pos, button->GetSize());
400 if(stringRa.empty() || stringRb.empty() || stringRc.empty() || stringRd.empty() || stringRe.empty())
405 double Ra, Rb, Rc, Rd, Re;
422 std::vector<float> emor(5, 0.0);
423 std::vector<double> outLutStd;
427 std::vector<hugin_utils::FDiff2D> points;
428 for(
size_t i=0; i<outLutStd.size(); i++)
432 graph.
DrawLine(points, wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT), 1);
441 std::vector<double> outLut;
445 for(
size_t i=0; i<outLut.size(); i++)
449 graph.
DrawLine(points, wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT), 2);
455 std::vector<hugin_utils::FDiff2D> points;
458 graph.
DrawLine(points, wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT), 2);
464 wxWindow *button = (wxWindow*) e.GetEventObject();
465 wxPoint pos=button->ClientToScreen(wxPoint(0,0));
466 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
int HuginMessageBox(const wxString &message, const wxString &caption, int style, wxWindow *parent)
void InitValues()
copy the variables from Panorama to dialog