28 #include "hugin_config.h"
29 #include <wx/stdpaths.h>
42 #include <pano13/queryfeature.h>
65 #define WX_BROKEN_SIZER_UNKNOWN
68 EVT_CHOICE ( XRCID("pano_choice_pano_type"),
PanoPanel::ProjectionChanged )
69 EVT_TEXT_ENTER( XRCID("pano_text_hfov"),
PanoPanel::HFOVChanged )
70 EVT_TEXT_ENTER( XRCID("pano_text_vfov"),
PanoPanel::VFOVChanged )
71 EVT_BUTTON ( XRCID("pano_button_calc_fov"),
PanoPanel::DoCalcFOV)
72 EVT_TEXT_ENTER ( XRCID("pano_val_width"),
PanoPanel::WidthChanged )
73 EVT_TEXT_ENTER ( XRCID("pano_val_height"),
PanoPanel::HeightChanged )
74 EVT_TEXT_ENTER ( XRCID("pano_val_roi_top"),
PanoPanel::ROIChanged )
75 EVT_TEXT_ENTER ( XRCID("pano_val_roi_bottom"),
PanoPanel::ROIChanged )
76 EVT_TEXT_ENTER ( XRCID("pano_val_roi_left"),
PanoPanel::ROIChanged )
77 EVT_TEXT_ENTER ( XRCID("pano_val_roi_right"),
PanoPanel::ROIChanged )
78 EVT_BUTTON ( XRCID("pano_button_opt_width"),
PanoPanel::DoCalcOptimalWidth)
79 EVT_BUTTON ( XRCID("pano_button_opt_roi"),
PanoPanel::DoCalcOptimalROI)
80 EVT_BUTTON ( XRCID("pano_button_stitch"),
PanoPanel::OnDoStitch )
82 EVT_CHECKBOX ( XRCID("pano_cb_ldr_output_blended"),
PanoPanel::OnOutputFilesChanged)
83 EVT_CHECKBOX ( XRCID("pano_cb_ldr_output_layers"),
PanoPanel::OnOutputFilesChanged)
84 EVT_CHECKBOX ( XRCID("pano_cb_ldr_output_exposure_layers"),
PanoPanel::OnOutputFilesChanged)
85 EVT_CHECKBOX ( XRCID("pano_cb_ldr_output_exposure_blended"),
PanoPanel::OnOutputFilesChanged)
86 EVT_CHECKBOX ( XRCID("pano_cb_ldr_output_exposure_layers_fused"),
PanoPanel::OnOutputFilesChanged)
87 EVT_CHECKBOX ( XRCID("pano_cb_ldr_output_stacks"),
PanoPanel::OnOutputFilesChanged)
88 EVT_CHECKBOX ( XRCID("pano_cb_ldr_output_exposure_remapped"),
PanoPanel::OnOutputFilesChanged)
89 EVT_CHECKBOX ( XRCID("pano_cb_hdr_output_blended"),
PanoPanel::OnOutputFilesChanged)
90 EVT_CHECKBOX ( XRCID("pano_cb_hdr_output_stacks"),
PanoPanel::OnOutputFilesChanged)
91 EVT_CHECKBOX ( XRCID("pano_cb_hdr_output_layers"),
PanoPanel::OnOutputFilesChanged)
93 EVT_CHOICE ( XRCID("pano_choice_remapper"),
PanoPanel::RemapperChanged )
94 EVT_BUTTON ( XRCID("pano_button_remapper_opts"),
PanoPanel::OnRemapperOptions )
96 EVT_CHOICE ( XRCID("pano_choice_fusion"),
PanoPanel::FusionChanged )
97 EVT_BUTTON ( XRCID("pano_button_fusion_opts"),
PanoPanel::OnFusionOptions )
99 EVT_CHOICE ( XRCID("pano_choice_hdrmerge"),
PanoPanel::HDRMergeChanged )
100 EVT_BUTTON ( XRCID("pano_button_hdrmerge_opts"),
PanoPanel::OnHDRMergeOptions )
102 EVT_CHOICE ( XRCID("pano_choice_blender"),
PanoPanel::BlenderChanged )
103 EVT_BUTTON ( XRCID("pano_button_blender_opts"),
PanoPanel::OnBlenderOptions )
105 EVT_CHOICE ( XRCID("pano_choice_edgefill"),
PanoPanel::OnEdgeFillChanged)
106 EVT_BUTTON ( XRCID("pano_button_fill_opts"),
PanoPanel::OnEdgeFillOptions)
108 EVT_CHOICE ( XRCID("pano_choice_file_format"),
PanoPanel::FileFormatChanged )
109 EVT_CHOICE ( XRCID("pano_choice_hdr_file_format"),
PanoPanel::HDRFileFormatChanged )
111 EVT_TEXT_ENTER ( XRCID("pano_output_normal_opts_jpeg_quality"),
PanoPanel::OnJPEGQualityText )
112 EVT_CHOICE ( XRCID("pano_output_normal_opts_tiff_compression"),
PanoPanel::OnNormalTIFFCompression)
113 EVT_CHOICE ( XRCID("pano_output_hdr_opts_tiff_compression"),
PanoPanel::OnHDRTIFFCompression)
118 : pano(0), m_guiLevel(
GUI_SIMPLE), updatesDisabled(false)
124 long style,
const wxString& name)
126 if (! wxPanel::Create(parent,
id, pos, size, style, name)) {
130 wxXmlResource::Get()->LoadPanel(
this, wxT(
"panorama_panel"));
131 wxPanel * panel = XRCCTRL(*
this,
"panorama_panel", wxPanel);
133 wxBoxSizer *topsizer =
new wxBoxSizer( wxVERTICAL );
134 topsizer->Add(panel, 1, wxEXPAND, 0);
145 #ifdef ThisNeverHappens
147 wxLogMessage(_(
"Fisheye"));
148 wxLogMessage(_(
"Stereographic"));
149 wxLogMessage(_(
"Mercator"));
150 wxLogMessage(_(
"Trans Mercator"));
151 wxLogMessage(_(
"Sinusoidal"));
152 wxLogMessage(_(
"Lambert Cylindrical Equal Area"));
153 wxLogMessage(_(
"Lambert Equal Area Azimuthal"));
154 wxLogMessage(_(
"Albers Equal Area Conic"));
155 wxLogMessage(_(
"Miller Cylindrical"));
156 wxLogMessage(_(
"Panini"));
157 wxLogMessage(_(
"Architectural"));
158 wxLogMessage(_(
"Orthographic"));
159 wxLogMessage(_(
"Equisolid"));
160 wxLogMessage(_(
"Equirectangular Panini"));
161 wxLogMessage(_(
"Biplane"));
162 wxLogMessage(_(
"Triplane"));
163 wxLogMessage(_(
"Panini General"));
164 wxLogMessage(_(
"Thoby Projection"));
165 wxLogMessage(_(
"Hammer-Aitoff Equal Area"));
169 int nP = panoProjectionFormatCount();
170 for(
int n=0; n < nP; n++) {
171 pano_projection_features proj;
172 if (panoProjectionFeaturesQuery(n, &proj)) {
173 wxString str2(proj.name, wxConvLocal);
177 m_HFOVText = XRCCTRL(*
this,
"pano_text_hfov" ,wxTextCtrl);
182 m_VFOVText = XRCCTRL(*
this,
"pano_text_vfov" ,wxTextCtrl);
187 m_WidthTxt = XRCCTRL(*
this,
"pano_val_width", wxTextCtrl);
193 m_HeightTxt = XRCCTRL(*
this,
"pano_val_height", wxTextCtrl);
197 m_ROILeftTxt = XRCCTRL(*
this,
"pano_val_roi_left", wxTextCtrl);
201 m_ROIRightTxt = XRCCTRL(*
this,
"pano_val_roi_right", wxTextCtrl);
205 m_ROITopTxt = XRCCTRL(*
this,
"pano_val_roi_top", wxTextCtrl);
209 m_ROIBottomTxt = XRCCTRL(*
this,
"pano_val_roi_bottom", wxTextCtrl);
248 m_pano_ctrls = XRCCTRL(*
this,
"pano_controls_panel", wxScrolledWindow);
278 wxConfigBase::Get()->Write(wxT(
"Stitcher/DefaultRemapper"),
m_RemapperChoice->GetSelection());
279 wxConfigBase::Get()->Flush();
299 #ifdef STACK_CHECK //Disabled for 0.7.0 release
302 const bool hasStacks =
false;
323 DEBUG_DEBUG(hdrStacks.size() <<
": HDR stacks detected");
324 const bool hasStacks = (hdrStacks.size() != activeImages.size());
375 m_HFOVText->ChangeValue(wxString(val.c_str(), wxConvLocal));
377 m_VFOVText->ChangeValue(wxString(val.c_str(), wxConvLocal));
395 wxString label = wxString::Format(wxT(
"%d x %d"), opt.
getROI().width(), opt.
getROI().height());
397 if ( (opt.
getROI().width() / 1000.0) * opt.
getROI().height() / 1000.0 >= 20.0)
399 label.Append(wxString::Format(wxT(
"=%.0f MP"), (opt.
getROI().width() / 1000.0) * opt.
getROI().height() / 1000.0));
403 label.Append(wxString::Format(wxT(
"=%.1f MP"), opt.
getROI().area() / 1000000.0));
405 if (opt.
getROI().width() >0 && opt.
getROI().height() > 0)
410 label.Append(wxString::Format(wxT(
", %d:%d"), opt.
getROI().width() / commonDivisor, opt.
getROI().height() / commonDivisor));
414 float ratio = 1.0f * opt.
getROI().width() / opt.
getROI().height();
417 label.Append(wxString::Format(wxT(
", %.2f:1"), ratio));
421 label.Append(wxString::Format(wxT(
", 1:%.2f"), 1.0f/ratio));
425 XRCCTRL(*
this,
"pano_size_label", wxStaticText)->SetLabel(label);
429 XRCCTRL(*
this,
"pano_cb_ldr_output_blended", wxCheckBox)->SetValue(opt.
outputLDRBlended);
432 XRCCTRL(*
this,
"pano_cb_hdr_output_blended", wxCheckBox)->SetValue(opt.
outputHDRBlended);
437 XRCCTRL(*
this,
"pano_cb_ldr_output_layers", wxCheckBox)->SetValue(opt.
outputLDRLayers);
441 XRCCTRL(*
this,
"pano_cb_hdr_output_layers", wxCheckBox)->SetValue(opt.
outputHDRLayers);
446 XRCCTRL(*
this,
"pano_cb_ldr_output_stacks", wxCheckBox)->SetValue(opt.
outputLDRStacks);
448 XRCCTRL(*
this,
"pano_cb_hdr_output_stacks", wxCheckBox)->SetValue(opt.
outputHDRStacks);
468 bool any_output_possible = hasImages && anyOutputSelected;
471 #ifdef STACK_CHECK //Disabled for 0.7.0 release
473 XRCCTRL(*
this,
"pano_cb_ldr_output_blended",wxCheckBox)->Disable();
474 XRCCTRL(*
this,
"pano_cb_ldr_output_layers",wxCheckBox)->Disable();
476 XRCCTRL(*
this,
"pano_cb_ldr_output_exposure_layers",wxCheckBox)->Enable();
477 XRCCTRL(*
this,
"pano_cb_ldr_output_exposure_blended",wxCheckBox)->Enable();
478 XRCCTRL(*
this,
"pano_cb_ldr_output_exposure_remapped",wxCheckBox)->Enable();
479 XRCCTRL(*
this,
"pano_cb_hdr_output_blended",wxCheckBox)->Enable();
480 XRCCTRL(*
this,
"pano_cb_hdr_output_stacks",wxCheckBox)->Enable();
481 XRCCTRL(*
this,
"pano_cb_hdr_output_layers",wxCheckBox)->Enable();
484 XRCCTRL(*
this,
"pano_cb_ldr_output_blended",wxCheckBox)->Enable();
485 XRCCTRL(*
this,
"pano_cb_ldr_output_layers",wxCheckBox)->Enable();
487 XRCCTRL(*
this,
"pano_cb_ldr_output_exposure_layers",wxCheckBox)->Disable();
488 XRCCTRL(*
this,
"pano_cb_ldr_output_exposure_blended",wxCheckBox)->Disable();
489 XRCCTRL(*
this,
"pano_cb_ldr_output_exposure_remapped",wxCheckBox)->Disable();
491 XRCCTRL(*
this,
"pano_cb_hdr_output_blended",wxCheckBox)->Disable();
492 XRCCTRL(*
this,
"pano_cb_hdr_output_stacks",wxCheckBox)->Disable();
493 XRCCTRL(*
this,
"pano_cb_hdr_output_layers",wxCheckBox)->Disable();
514 XRCCTRL(*
this,
"pano_button_blender_opts", wxButton)->Enable(blenderEnabled);
516 XRCCTRL(*
this,
"pano_text_blender", wxStaticText)->Enable(blenderEnabled);
519 XRCCTRL(*
this,
"pano_button_fill_opts", wxButton)->Enable(
m_edgeFillChoice->GetSelection() != 0);
524 XRCCTRL(*
this,
"pano_button_fusion_opts", wxButton)->Enable(fusionEnabled);
526 XRCCTRL(*
this,
"pano_text_fusion", wxStaticText)->Enable(fusionEnabled);
532 XRCCTRL(*
this,
"pano_button_hdrmerge_opts", wxButton)->Enable(hdrMergeEnabled);
534 XRCCTRL(*
this,
"pano_text_hdrmerge", wxStaticText)->Enable(hdrMergeEnabled);
542 XRCCTRL(*
this,
"pano_output_ldr_format_label", wxStaticText)->Enable(ldr_pano_enabled);
583 wxLogError(wxT(
"INTERNAL error: unknown output image type"));
589 XRCCTRL(*
this,
"pano_output_hdr_format_label", wxStaticText)->Enable(hdr_pano_enabled);
590 XRCCTRL(*
this,
"pano_output_hdr_format_label", wxStaticText)->Show(hdr_pano_enabled ||
m_guiLevel>
GUI_SIMPLE);
617 wxLogError(wxT(
"INTERNAL error: unknown hdr output image type"));
626 this->Refresh(
false);
654 DEBUG_INFO (
"HFOV = " << text.mb_str(wxConvLocal) );
655 if (text == wxT(
"")) {
661 wxLogError(_(
"Value must be numeric."));
666 wxLogError(wxString::Format(
667 _(
"Invalid HFOV value. Maximum HFOV for this projection is %lf."),
685 DEBUG_INFO (
"VFOV = " << text.mb_str(wxConvLocal) );
686 if (text == wxT(
"")) {
692 wxLogError(_(
"Value must be numeric."));
697 wxLogError(wxString::Format(
698 _(
"Invalid VFOV value. Maximum VFOV for this projection is %lf."),
737 if (nWidth <= 0)
return;
744 wxLogError(_(
"width needs to be an integer bigger than 0"));
754 if(nHeight <= 0)
return;
761 wxLogError(_(
"height needs to be an integer bigger than 0"));
769 long left, right, top, bottom;
771 wxLogError(_(
"Top needs to be an integer bigger than 0"));
775 wxLogError(_(
"left needs to be an integer bigger than 0"));
779 wxLogError(_(
"right needs to be an integer bigger than 0"));
783 wxLogError(_(
"bottom needs to be an integer bigger than 0"));
786 opt.
setROI(vigra::Rect2D(left, top, right, bottom));
789 if(opt.
getROI().width()<1) {
790 wxLogError(_(
"Left boundary must be smaller than right."));
795 if(opt.
getROI().height()<1) {
796 wxLogError(_(
"Top boundary must be smaller than bottom."));
841 wxXmlResource::Get()->LoadDialog(&dlg,
this, wxT(
"nona_options_dialog"));
842 wxChoice * interpol_choice = XRCCTRL(dlg,
"nona_choice_interpolator", wxChoice);
843 wxCheckBox * cropped_cb = XRCCTRL(dlg,
"nona_save_cropped", wxCheckBox);
846 dlg.CentreOnParent();
848 if (dlg.ShowModal() == wxID_OK) {
849 int interpol = interpol_choice->GetSelection();
859 wxLogError(_(
"PTmender options not yet implemented"));
878 wxXmlResource::Get()->LoadDialog(&dlg,
this, wxT(
"enblend_options_dialog"));
879 wxTextCtrl * enblend_opts_text = XRCCTRL(dlg,
"blender_arguments_text", wxTextCtrl);
880 enblend_opts_text->ChangeValue(wxString(opt.
enblendOptions.c_str(), wxConvLocal));
881 dlg.Bind(wxEVT_COMMAND_BUTTON_CLICKED, [](wxCommandEvent &) {
MainFrame::Get()->
DisplayHelp(wxT(
"Enblend.html")); }, wxID_HELP);
882 dlg.CentreOnParent();
884 if (dlg.ShowModal() == wxID_OK) {
885 opt.
enblendOptions = enblend_opts_text->GetValue().mb_str(wxConvLocal);
896 wxXmlResource::Get()->LoadDialog(&dlg,
this, wxT(
"verdandi_options_dialog"));
897 wxChoice * verdandiBlendModeChoice = XRCCTRL(dlg,
"verdandi_blend_mode_choice", wxChoice);
900 verdandiBlendModeChoice->SetSelection(1);
904 verdandiBlendModeChoice->SetSelection(0);
906 dlg.CentreOnParent();
908 if (dlg.ShowModal() == wxID_OK)
910 if (verdandiBlendModeChoice->GetSelection() == 1)
923 wxLogError(_(
"PTblender options not yet implemented"));
947 wxXmlResource::Get()->LoadDialog(&dlg,
this, wxT(
"filledge_options_dialog"));
948 wxCheckBox* keepUnfillVersion = XRCCTRL(dlg,
"edgefill_save_input", wxCheckBox);
950 dlg.CentreOnParent();
952 if (dlg.ShowModal() == wxID_OK)
962 DEBUG_DEBUG(
"changing stacking program to " << fusion);
969 wxXmlResource::Get()->LoadDialog(&dlg,
this, wxT(
"enfuse_options_dialog"));
970 wxTextCtrl * enfuse_opts_text = XRCCTRL(dlg,
"enfuse_arguments_text", wxTextCtrl);
971 enfuse_opts_text->ChangeValue(wxString(opt.
enfuseOptions.c_str(), wxConvLocal));
972 dlg.Bind(wxEVT_COMMAND_BUTTON_CLICKED, [](wxCommandEvent &) {
MainFrame::Get()->
DisplayHelp(wxT(
"Enfuse.html")); }, wxID_HELP);
973 dlg.CentreOnParent();
975 if (dlg.ShowModal() == wxID_OK) {
976 opt.
enfuseOptions = enfuse_opts_text->GetValue().mb_str(wxConvLocal);
996 if (dlg.ShowModal() == wxOK)
1004 wxLogError(_(
"Options for this HDRMerge program not yet implemented"));
1037 double sizeFactor = 1.0;
1038 if (wxGetKeyState(WXK_COMMAND))
1063 vigra::Rect2D newROI;
1075 if(!newROI.isEmpty())
1103 wxString tempDir= wxConfigBase::Get()->Read(wxT(
"tempDir"),wxT(
""));
1104 if(!tempDir.IsEmpty())
1105 if(tempDir.Last()!=wxFileName::GetPathSeparator())
1106 tempDir.Append(wxFileName::GetPathSeparator());
1107 wxString currentPTOfn = wxFileName::CreateTempFileName(tempDir+wxT(
"huginpto_"));
1108 if(currentPTOfn.empty()) {
1109 wxMessageBox(_(
"Could not create temporary project file"),_(
"Error"),
1110 wxCANCEL | wxICON_ERROR,
this);
1113 DEBUG_DEBUG(
"tmp PTO file: " << (
const char *)currentPTOfn.mb_str(wxConvLocal));
1120 #if defined __WXMAC__ && defined MAC_SELF_CONTAINED_BUNDLE
1122 wxString hugin_stitch_project = MacGetPathToBundledAppMainExecutableFile(CFSTR(
"HuginStitchProject.app"));
1123 if(hugin_stitch_project == wxT(
""))
1125 DEBUG_ERROR(
"hugin_stitch_project could not be found in the bundle.");
1129 #elif defined __WXMAC__
1131 wxFileName hugin_stitch_project_app(wxT(INSTALL_OSX_BUNDLE_DIR), wxEmptyString);
1132 hugin_stitch_project_app.AppendDir(wxT(
"HuginStitchProject.app"));
1133 CFStringRef stitchProjectAppPath = MacCreateCFStringWithWxString(hugin_stitch_project_app.GetFullPath());
1134 wxString hugin_stitch_project = MacGetPathToMainExecutableFileOfBundle(stitchProjectAppPath);
1135 CFRelease(stitchProjectAppPath);
1137 wxString hugin_stitch_project = wxT(
"hugin_stitch_project");
1142 outputPrefix.Normalize(wxPATH_NORM_ABSOLUTE | wxPATH_NORM_DOTS | wxPATH_NORM_TILDE | wxPATH_NORM_SHORTCUT);
1148 wxFileDialog dlg(
this,_(
"Specify output prefix"),
1149 outputPrefix.GetPath(), outputPrefix.GetName(), wxT(
""),
1150 wxFD_SAVE, wxDefaultPosition);
1151 if (dlg.ShowModal() != wxID_OK)
1158 list.Add(dlg.GetPath());
1160 if(dlg.ShowModal()!=wxID_OK)
1163 wxFileName prefix(dlg.GetPath());
1164 while (!prefix.IsDirWritable())
1166 wxMessageBox(wxString::Format(_(
"You have no permissions to write in folder \"%s\".\nPlease select another folder for the final output."), prefix.GetPath().c_str()),
1172 wxOK | wxICON_INFORMATION);
1173 if (dlg.ShowModal() != wxID_OK)
1177 prefix = dlg.GetPath();
1185 wxString switches(wxT(
" --delete -o "));
1187 switches=wxT(
" --overwrite")+switches;
1188 if (!userDefinedSetting.IsEmpty())
1194 wxConfigBase::Get()->Flush();
1198 wxProcess *my_process =
new wxProcess(
this);
1199 my_process->Redirect();
1202 my_process->Detach();
1203 wxExecute(command,wxEXEC_ASYNC, my_process);
1228 wxString switches(wxT(
" "));
1231 switches += wxT(
"-b ");
1235 switches += wxT(
"-o ");
1239 switches += wxT(
"-v ");
1241 if (!userDefinedSetting.IsEmpty())
1247 bool showDlg=wxConfigBase::Get()->Read(wxT(
"ShowSaveMessage"), 1l)==1;
1253 wxXmlResource::Get()->LoadDialog(&dlg,
this, wxT(
"stitch_message_dlg"));
1257 XRCCTRL(dlg,
"stitch_message_text", wxStaticText)->SetLabel(
1258 wxString::Format(_(
"The project %s will be automatically saved before it can be sent to the batch processor PTBatcherGUI.\nYou will then be asked for the prefix for the panorama output.\n\nYou may need to start the stitching in the batch processor\n PTBatcherGUI if it doesn't start automatically."),
1265 if(XRCCTRL(dlg,
"stitch_dont_show_checkbox", wxCheckBox)->IsChecked())
1267 wxConfigBase::Get()->Write(wxT(
"ShowSaveMessage"), 0l);
1271 wxCommandEvent dummy;
1283 outputPrefix.Normalize(wxPATH_NORM_ABSOLUTE | wxPATH_NORM_DOTS | wxPATH_NORM_TILDE | wxPATH_NORM_SHORTCUT);
1287 wxFileDialog dlg(
this,_(
"Specify output prefix"),
1288 outputPrefix.GetPath(), outputPrefix.GetName(), wxT(
""),
1289 wxFD_SAVE, wxDefaultPosition);
1290 if (dlg.ShowModal() != wxID_OK)
1297 list.Add(dlg.GetPath());
1299 if(dlg.ShowModal()!=wxID_OK)
1302 wxFileName prefix(dlg.GetPath());
1303 while (!prefix.IsDirWritable())
1305 wxMessageBox(wxString::Format(_(
"You have no permissions to write in folder \"%s\".\nPlease select another folder for the final output."), prefix.GetPath().c_str()),
1311 wxOK | wxICON_INFORMATION);
1312 if (dlg.ShowModal() != wxID_OK)
1316 prefix = dlg.GetPath();
1324 #if defined __WXMAC__ && defined MAC_SELF_CONTAINED_BUNDLE
1325 wxString cmd = MacGetPathToMainExecutableFileOfRegisteredBundle(CFSTR(
"net.sourceforge.hugin.PTBatcherGUI"));
1337 wxMessageBox(wxString::Format(_(
"External program %s not found in the bundle, reverting to system path"), wxT(
"open")), _(
"Error"));
1343 const wxFileName exePath(wxStandardPaths::Get().GetExecutablePath());
1367 wxFileName userOutputSequence;
1368 if (settings.IsEmpty())
1371 wxConfigBase* config = wxConfigBase::Get();
1373 wxFileDialog userOutputDlg(
this, _(
"Select user defined output"),
1374 path, wxT(
""), _(
"User defined output|*.executor"),
1375 wxFD_OPEN | wxFD_FILE_MUST_EXIST, wxDefaultPosition);
1376 if (userOutputDlg.ShowModal() != wxID_OK)
1381 config->Write(wxT(
"/userDefinedOutputPath"), userOutputDlg.GetDirectory());
1382 userOutputSequence = userOutputDlg.GetPath();
1387 userOutputSequence = settings;
1388 if (!userOutputSequence.Exists())
1390 wxMessageBox(wxString::Format(wxT(
"User defined output %s not found.\nStopping processing."), userOutputSequence.GetFullPath()), _(
"Warning"), wxOK | wxICON_INFORMATION);
1400 if(wxGetKeyState(WXK_COMMAND))
1497 switch(e.GetSelection()) {
1524 switch(e.GetSelection()) {
1549 if (
id == XRCID(
"pano_cb_ldr_output_blended") ) {
1551 }
else if (
id == XRCID(
"pano_cb_ldr_output_layers") ) {
1553 }
else if (
id == XRCID(
"pano_cb_ldr_output_exposure_layers") ) {
1555 }
else if (
id == XRCID(
"pano_cb_ldr_output_exposure_blended") ) {
1557 }
else if (
id == XRCID(
"pano_cb_ldr_output_exposure_layers_fused") ) {
1559 }
else if (
id == XRCID(
"pano_cb_ldr_output_exposure_remapped") ) {
1561 }
else if (
id == XRCID(
"pano_cb_ldr_output_stacks") ) {
1563 }
else if (
id == XRCID(
"pano_cb_hdr_output_blended") ) {
1565 }
else if (
id == XRCID(
"pano_cb_hdr_output_stacks") ) {
1567 }
else if (
id == XRCID(
"pano_cb_hdr_output_layers") ) {
1579 const vigra::Rect2D cropped_region (opts.getROI());
1581 if (opts.outputImageType ==
"jpg" &&
1582 (opts.outputLDRBlended || opts.outputLDRExposureBlended || opts.outputLDRExposureLayersFused) &&
1583 (cropped_region.width()>65500 || cropped_region.height()>65500)
1587 wxString::Format(_(
"The width and height of jpeg images has to be smaller than 65500 pixel. But you have requested a jpeg image with %dx%d pixel.\nThis is not supported by the jpeg file format.\nDecrease the canvas size on the stitch panel or select TIF or PNG as output format."), cropped_region.width(), cropped_region.height()),
1593 wxICON_EXCLAMATION | wxOK);
1597 const unsigned long long area = (
static_cast<unsigned long long>(cropped_region.width()) * cropped_region.height());
1599 if (area > 500000000)
1601 message = wxString::Format(_(
"The panorama you are trying to stitch is %.1f gigapixels.\nIf this is too big, reduce the panorama Canvas Size and the cropped region and stitch from the Stitcher tab. Stitching a panorama this size could take a long time and a large amount of memory."),
1602 area / 1000000000.0);
1606 if (cropped_region.width() > 32700 || cropped_region.height() > 32700)
1608 message = _(
"The width or the height of the final panorama exceeds 32700 pixel.\nSome programs have problems to open or display such big images.\n\nIf this is too big, reduce the panorama Canvas Size or the cropped region.");
1611 if (!message.empty())
1615 wxMessageDialog dialog(
this,
1616 _(
"Are you sure you want to stitch such a large panorama?"),
1622 wxICON_EXCLAMATION | wxYES_NO);
1623 dialog.SetExtendedMessage(message);
1624 dialog.SetYesNoLabels(_(
"Stitch anyway"), _(
"Let me fix that"));
1625 switch (dialog.ShowModal())
1635 if (!mainframe->IsShown())
1652 wxMessageBox(_(
"There are no active images in the output region.\nPlease check your settings, so that at least one image is in the output region."),
1658 wxOK | wxICON_INFORMATION);
1660 return !images.empty();
1665 wxLongLong freeSpace;
1666 if (wxGetDiskSpace(folder, NULL, &freeSpace))
1671 wxMessageDialog dialog(
this,
1672 wxString::Format(_(
"The folder \"%s\" has only %.1f MiB free. This is not enough for stitching the current panorama. Decrease the output size or select another output folder.\nAre you sure that you still want to stitch it?"), folder.c_str(), freeSpace.ToDouble() / 1048576.0),
1678 wxICON_EXCLAMATION | wxYES_NO);
1679 dialog.SetYesNoLabels(_(
"Stitch anyway"), _(
"Let me fix that"));
1680 if (dialog.ShowModal() == wxID_NO)
1684 if (!mainframe->IsShown())
1705 : wxXmlResourceHandler()
1714 cp->Create(m_parentAsWindow,
1716 GetPosition(), GetSize(),
1717 GetStyle(wxT(
"style")),
1727 return IsOfClass(node, wxT(
"PanoPanel"));
void DisplayHelp(wxString section=wxEmptyString)
call help browser with given file
Dialog for reset panorama settings.
bool CheckHasImages()
check if the output contains images at all
void OnBlenderOptions(wxCommandEvent &e)
void SetCommandLineArgument(wxString cmd)
sets the currents state of the hdrmerge options
int gcd(int a, int b)
function to calculate greated common divisor using Euclidean algorithm both arguments should be >=0 ...
PanoramaOptions::ProjectionFormat getProjection() const
void BlenderChanged(wxCommandEvent &e)
std::vector< UIntSet > getHDRStacks(const PanoramaData &pano, UIntSet allImgs, PanoramaOptions opts)
returns vector of set of output stacks
bool FileExists(const std::string &filename)
checks if file exists
void HeightChanged(wxCommandEvent &e)
declaration of functions to handle stacks and layers
void DoStitch(const wxString &userDefinedSetting=wxEmptyString)
stitching using hugin_stitch_project
void OnNormalTIFFCompression(wxCommandEvent &e)
EdgeFillMode edgeFillMode
wxString GetDataPath()
return path to data directory, it depends on operating system
bool CheckFreeSpace(const wxString &folder)
check if there is enough free disk space
void ShowStitcherTab()
opens the stitcher tab
void setHeight(unsigned int h)
set panorama height
void EnableControls(bool enable)
enable/disable control influenced by quick mode
BlendingMechanism
blenders
void DoCalcFOV(wxCommandEvent &e)
bool str2double(const wxString &s, double &d)
void ProjectionChanged(wxCommandEvent &e)
void ROIChanged(wxCommandEvent &e)
bool outputLDRLayers
save remapped layers (LDR)
virtual wxObject * DoCreateResource()
bool fovCalcSupported(ProjectionFormat f) const
true, if FOV calcuations are supported for projection f
bool removeObserver(PanoramaObserver *observer)
remove a panorama observer.
misc math function & classes used by other parts of the program
void OnFusionOptions(wxCommandEvent &e)
EdgeFillMode
edge fill modes
Definition of CPImagesComboBox and CPImagesComboBoxXmlHandler class.
str wxQuoteString(const str &arg)
Try to escape special chars on windows and linux.
void OnEdgeFillChanged(wxCommandEvent &e)
std::string outputImageTypeHDRCompression
bool outputHDRLayers
save remapped layers (HDR)
unsigned int getHeight() const
get panorama height
UIntSet getImagesinROI(const PanoramaData &pano, const UIntSet activeImages)
returns set of images which are visible in output ROI
void UpdateDisplay(const HuginBase::PanoramaOptions &opt, const bool hasStacks)
wxButton * m_CalcOptWidthButton
double getMaxHFOV() const
get maximum possible hfov with current projection
#define DEBUG_ASSERT(cond)
bool SaveLensDataFromPano(const HuginBase::Panorama &pano)
routine for automatically saving information from pano into database
std::string enfuseOptions
HuginBase::Panorama * pano
include file for the hugin project
wxString GetCommandLineArgument()
returns the hdrmerge options as command line arguments
virtual void run()
runs the algorithm.
std::string outputImageTypeCompression
void DoUserDefinedStitch(const wxString &settings=wxString())
stitching with user defined file
wxScrolledWindow * m_pano_ctrls
std::string doubleToString(double d, int digits)
convert a double to a string, suitable for display within a GUI.
void SetGuiLevel(GuiLevel newGuiLevel)
void OnRemapperOptions(wxCommandEvent &e)
bool outputLDRExposureBlended
< save exposure fused stacks (no exposure adjustment)
void VFOVChanged(wxCommandEvent &e)
std::set< unsigned int > UIntSet
wxStaticText * m_FileFormatOptionsLabel
class to access Hugins camera and lens database
void Init(HuginBase::Panorama *pano)
wxTextCtrl * m_ROIBottomTxt
const vigra::Rect2D & getROI() const
Definition of dialog for hdrmerge options.
bool outputLDRBlended
save blended panorama (LDR)
void RemapperChanged(wxCommandEvent &e)
wxTextCtrl * m_ROILeftTxt
wxChoice * m_BlenderChoice
wxChoice * m_edgeFillChoice
std::size_t getNrOfImages() const
number of images.
static MainFrame * Get()
hack.. kind of a pseudo singleton...
wxTextCtrl * m_FileFormatJPEGQualityText
wxChoice * m_FusionChoice
vigra_ext::Interpolator interpolator
float pow(float a, double b)
virtual void panoramaChanged(HuginBase::Panorama &pano)
this is called whenever the panorama has changed.
wxChoice * m_RemapperChoice
static double calcOptimalScale(PanoramaData &panorama)
virtual vigra::Rect2D getResultOptimalROI()
return the ROI structure?, for now area
double getMaxVFOV() const
get maximum possible vfov with current projection
virtual double getResultHeight()
IMPLEMENT_DYNAMIC_CLASS(wxTreeListHeaderWindow, wxWindow)
bool outputHDRBlended
save blended panorama (HDR)
void OnHDRTIFFCompression(wxCommandEvent &e)
static GlobalCmdHist & getInstance()
void OnEdgeFillOptions(wxCommandEvent &e)
void FileFormatChanged(wxCommandEvent &e)
#define HUGIN_PROCESSOR_START
void addCommand(PanoCommand *command, bool execute=true)
Adds a command to the history.
void FusionChanged(wxCommandEvent &e)
wxChoice * m_HDRMergeChoice
wxChoice * m_FileFormatHDRTIFFCompChoice
void setROI(const vigra::Rect2D &val)
void WidthChanged(wxCommandEvent &e)
void OnSaveProject(wxCommandEvent &e)
UIntSet getActiveImages() const
get active images
wxChoice * m_ProjectionChoice
std::string tiffCompression
std::string verdandiOptions
#define HUGIN_PROCESSOR_OVERWRITE
void OnJPEGQualityText(wxCommandEvent &e)
wxButton * m_CalcHFOVButton
bool outputLDRExposureLayers
save blended exposure layers, do not perform fusion (no exposure adjustment)
void setHFOV(double h, bool keepView=true)
set the horizontal field of view.
wxButton * m_CalcOptROIButton
Contains various routines used for stitching panoramas.
void addObserver(PanoramaObserver *o)
add a panorama observer.
unsigned int getWidth() const
void HFOVChanged(wxCommandEvent &e)
include file for the hugin project
std::string enblendOptions
const PanoramaOptions & getOptions() const
returns the options for this panorama
Handle EVT_KILL_FOCUS and convert it to a EVT_TEXT_ENTER event.
virtual double getResultHorizontalFOV()
HDRMergeType hdrMergeMode
wxChoice * m_FileFormatTIFFCompChoice
bool outputLDRExposureRemapped
save remapped layers (no exposure adjustment)
wxButton * m_StitchButton
wxStaticText * m_HDRFileFormatLabelTIFFCompression
bool isDirty() const
true if there are unsaved changes
void DoCalcOptimalROI(wxCommandEvent &e)
set the largest rectangle for crop ROI
bool outputLDRExposureLayersFused
save blended exposure layers which are then fused (no exposure adjustment)
void DoCalcOptimalWidth(wxCommandEvent &e)
set the highest sensible width
void HDRFileFormatChanged(wxCommandEvent &e)
std::string outputImageType
void DoSendToBatch(const wxString &userDefinedSetting=wxEmptyString)
stitching with PTBatcherGUI
#define HUGIN_ASS_PANO_DOWNSIZE_FACTOR
std::string outputImageTypeHDR
functions for interaction with the hugin configuration file
wxChoice * m_FileFormatChoice
bool WritePTOFile(const std::string &filename, const std::string &prefix="")
write data to given pto file
void DoStitchOrSendBatch(const wxString &userDefinedSetting=wxEmptyString)
general stitching command, selects PTBatcherGUI or hugin_stitch_project depending on the settings in ...
#define HUGIN_PROCESSOR_GUI
bool CheckGoodSize()
Check the canvas size isn't overly huge, or the user knows what they are doing.
Define the pano edit panel.
std::string hdrmergeOptions
void OnHDRMergeOptions(wxCommandEvent &e)
virtual bool CanHandle(wxXmlNode *node)
#define HUGIN_PROCESSOR_VERBOSE
void setOptions(const PanoramaOptions &opt)
set new output settings This is not used directly for optimizing/stiching, but it can be feed into ru...
ProjectionFormat
Projection of final panorama.
void HDRMergeChanged(wxCommandEvent &e)
Interpolator
enum with all interpolation methods
str wxQuoteFilename(const str &arg)
Quote a filename, so that it is surrounded by "".
wxString getDefaultOutputName(const wxString projectname, const HuginBase::Panorama &pano, const wxString filenameTemplate)
gets the default output prefix, based on filename and images in project the setting is read from the ...
wxString getProjectName()
void setProjection(ProjectionFormat f)
set the Projection format and adjust the hfov/vfov if nessecary
bool outputHDRStacks
save image stacks (HDR)
wxChoice * m_HDRFileFormatChoice
virtual bool hasRunSuccessfully()
BlendingMechanism blendMode
bool Create(wxWindow *parent, wxWindowID id=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxTAB_TRAVERSAL, const wxString &name=wxT("panel"))
void OnOutputFilesChanged(wxCommandEvent &e)
HuginBase::PanoramaOptions m_oldOpt
void setWidth(unsigned int w, bool keepView=true)
set panorama width keep the HFOV, if keepView=true
void OnDoStitch(wxCommandEvent &e)
bool StackCheck(HuginBase::Panorama &pano)
wxTextCtrl * m_ROIRightTxt