27 #include <wx/stdpaths.h>
28 #include <wx/propgrid/advprops.h>
33 #include <wx/fileconf.h>
34 #include <wx/wfstream.h>
35 #include <wx/sstream.h>
51 bool OnDropFiles(wxCoord x, wxCoord y,
const wxArrayString& filenames)
55 for (
unsigned int i = 0; i < filenames.GetCount(); i++)
57 wxFileName file(filenames[i]);
58 if (file.GetExt().CmpNoCase(
"jpg") == 0 ||
59 file.GetExt().CmpNoCase(
"jpeg") == 0 ||
60 file.GetExt().CmpNoCase(
"tif") == 0 ||
61 file.GetExt().CmpNoCase(
"tiff") == 0 ||
62 file.GetExt().CmpNoCase(
"png") == 0 ||
63 file.GetExt().CmpNoCase(
"bmp") == 0 ||
64 file.GetExt().CmpNoCase(
"gif") == 0 ||
65 file.GetExt().CmpNoCase(
"pnm") == 0 ||
66 file.GetExt().CmpNoCase(
"sun") == 0 ||
67 file.GetExt().CmpNoCase(
"hdr") == 0 ||
68 file.GetExt().CmpNoCase(
"viff") == 0)
70 files.push_back(file.GetFullPath());
90 wxArrayString properties = wxStringTokenize(values,
"|");
91 for (
size_t i = 0; i < properties.size(); ++i)
93 wxArrayString prop = wxStringTokenize(properties[i],
":");
96 if (prop[1] ==
"double")
99 if (prop[2].ToCDouble(&doubleVal))
101 grid->SetPropertyValue(prop[0], doubleVal);
106 if (prop[1] ==
"long")
109 if (prop[2].ToLong(&longVal))
111 grid->SetPropertyValue(prop[0], longVal);
116 if (prop[1] ==
"bool")
118 if (prop[2] ==
"true")
120 grid->SetPropertyValue(prop[0],
true);
124 grid->SetPropertyValue(prop[0],
false);
140 wxPropertyGridConstIterator it;
142 for (it = grid->GetIterator(); !it.AtEnd(); it++)
144 const wxPGProperty* p = *it;
150 if (!output.IsEmpty())
154 const wxString type = p->GetValueType();
155 output.Append(p->GetName() +
":");
156 if (type ==
"double")
158 output.Append(
"double:" + wxString::FromCDouble(p->GetValue().GetDouble()));
164 output.Append(
"long:" + wxString::FromCDouble(p->GetValue().GetLong()));
170 if (p->GetValue().GetBool())
172 output.Append(
"bool:true");
176 output.Append(
"bool:false");
193 wxConfigBase* config = wxConfigBase::Get();
194 config->Write(
"/ToolboxFrame/Enfuse_Splitter", XRCCTRL(*
this,
"enfuse_splitter", wxSplitterWindow)->GetSashPosition());
199 config->Write(wxString::Format(
"/ToolboxFrame/FileListColumnWidth%d", j),
m_fileListCtrl->GetColumnWidth(j));
207 if (!wxPanel::Create(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL,
"panel"))
212 m_enfuseOptions =
new wxPropertyGrid(
this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxPG_SPLITTER_AUTO_CENTER);
220 wxXmlResource::Get()->LoadPanel(
this,
"enfuse_panel");
221 wxXmlResource::Get()->AttachUnknownControl(
"enfuse_properties",
m_enfuseOptions->GetGrid(),
this);
222 wxXmlResource::Get()->AttachUnknownControl(
"enfuse_preview_window",
m_preview,
this);
224 wxPanel* mainPanel = XRCCTRL(*
this,
"enfuse_panel", wxPanel);
225 wxBoxSizer* topsizer =
new wxBoxSizer(wxVERTICAL);
226 topsizer->Add(mainPanel, wxSizerFlags(1).Expand());
229 m_fileListCtrl->InsertColumn(0, _(
"Filename"), wxLIST_FORMAT_LEFT, 200);
230 m_fileListCtrl->InsertColumn(1, _(
"Aperture"), wxLIST_FORMAT_LEFT, 50);
231 m_fileListCtrl->InsertColumn(2, _(
"Shutter Speed"), wxLIST_FORMAT_LEFT, 50);
232 m_fileListCtrl->InsertColumn(3, _(
"ISO"), wxLIST_FORMAT_LEFT, 50);
237 wxConfigBase* config = wxConfigBase::Get();
239 if (config->HasEntry(
"/ToolboxFrame/Enfuse_Splitter"))
241 XRCCTRL(*
this,
"enfuse_splitter", wxSplitterWindow)->SetSashPosition(config->ReadLong(
"/ToolboxFrame/Enfuse_Splitter", 300));
243 const wxString enfuseOptionsString=config->Read(
"/ToolboxFrame/Enfuse_lastSettings");
244 if (!enfuseOptionsString.IsEmpty())
252 int width = config->Read(wxString::Format(
"/ToolboxFrame/FileListColumnWidth%d", j), -1);
285 wxFileName fullFilename(filename);
312 wxConfigBase* config = wxConfigBase::Get();
313 wxString path = config->Read(
"/actualPath",
"");
314 wxFileDialog dlg(
this, _(
"Add images"), path, wxEmptyString,
316 dlg.SetDirectory(path);
320 if (config->HasEntry(
"lastImageType"))
322 img_ext = config->Read(
"lastImageType").c_str();
324 if (img_ext ==
"all images")
325 dlg.SetFilterIndex(0);
326 else if (img_ext ==
"jpg")
327 dlg.SetFilterIndex(1);
328 else if (img_ext ==
"tiff")
329 dlg.SetFilterIndex(2);
330 else if (img_ext ==
"png")
331 dlg.SetFilterIndex(3);
332 else if (img_ext ==
"hdr")
333 dlg.SetFilterIndex(4);
334 else if (img_ext ==
"exr")
335 dlg.SetFilterIndex(5);
336 else if (img_ext ==
"all files")
337 dlg.SetFilterIndex(6);
340 if (dlg.ShowModal() == wxID_OK)
343 wxArrayString Pathnames;
344 dlg.GetPaths(Pathnames);
346 config->Write(
"/actualPath", dlg.GetDirectory());
348 switch (dlg.GetFilterIndex())
350 case 0: config->Write(
"lastImageType",
"all images");
break;
351 case 1: config->Write(
"lastImageType",
"jpg");
break;
352 case 2: config->Write(
"lastImageType",
"tiff");
break;
353 case 3: config->Write(
"lastImageType",
"png");
break;
354 case 4: config->Write(
"lastImageType",
"hdr");
break;
355 case 5: config->Write(
"lastImageType",
"exr");
break;
356 case 6: config->Write(
"lastImageType",
"all files");
break;
358 for (
auto& f : Pathnames)
372 if (
m_fileListCtrl->GetItemState(i, wxLIST_STATE_SELECTED) & wxLIST_STATE_SELECTED)
378 if (!selected.empty())
381 for (
auto i = selected.rbegin(); i != selected.rend(); ++i)
383 if (*i >= 0 && *i <
m_files.size())
403 long index =
m_fileListCtrl->GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
410 if (dlg.ShowModal() == wxID_OK)
416 for (
const auto& f : newFiles)
441 if (e.GetKeyCode() == 1 && e.CmdDown())
446 m_fileListCtrl->SetItemState(i, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED);
466 "[Enfuse_Settings]\n"
467 "Exposure fusion=exposureWeight:double:1|saturationWeight:double:0|contrastWeight:double:0|entropyWeight:double:0|hardMask:bool:false|levels:long:0|blendColorspace:long:0|wrapMode:long:0|exposureOptimum:double:0.5|exposureWidth:double:0.2|contrastEdgeScale:double:0|contrastMinCurvature:double:0|contrastWindowSize:long:5|entropyLowerCutoff:double:0|entropyUpperCutoff:double:100|entropyWindowSize:long:3|exposureLowerCutoff:double:0|exposureUpperCutoff:double:100|exposureWeightFunction:long:0|grayProjector:long:1\n"
468 "Focus stacking=exposureWeight:double:0|saturationWeight:double:0|contrastWeight:double:1|entropyWeight:double:0|hardMask:bool:true|levels:long:0|blendColorspace:long:0|wrapMode:long:0|exposureOptimum:double:0.5|exposureWidth:double:0.2|contrastEdgeScale:double:0|contrastMinCurvature:double:0|contrastWindowSize:long:5|entropyLowerCutoff:double:0|entropyUpperCutoff:double:100|entropyWindowSize:long:3|exposureLowerCutoff:double:0|exposureUpperCutoff:double:100|exposureWeightFunction:long:0|grayProjector:long:1\n"
471 wxFileConfig*
ReadIni(
const wxString& filename)
473 wxInputStream* iniStream{
nullptr };
474 if (wxFileExists(filename))
476 iniStream =
new wxFileInputStream(filename);
477 if (!iniStream->IsOk())
483 if (iniStream ==
nullptr)
485 iniStream =
new wxStringInputStream(
defaultIni);
488 wxFileConfig* iniFile=
new wxFileConfig(*iniStream);
496 wxFileConfig* iniFile =
ReadIni(iniFilename.GetFullPath());
498 iniFile->SetPath(
"Enfuse_Settings");
499 wxArrayString knownNames;
500 wxArrayString knownSettings;
503 bool hasKeys = iniFile->GetFirstEntry(key, indexKey);
506 knownNames.push_back(key);
507 knownSettings.push_back(iniFile->Read(key));
508 hasKeys = iniFile->GetNextEntry(key, indexKey);
510 int selection=wxGetSingleChoiceIndex(_(
"Select the Enfuse setting, which should be loaded."), _(
"Hugin toolbox"), knownNames, 0,
this);
521 wxFileConfig* iniFile =
ReadIni(iniFilename.GetFullPath());
523 iniFile->SetPath(
"Enfuse_Settings");
524 wxArrayString knownNames;
527 bool hasKeys = iniFile->GetFirstEntry(key, indexKey);
530 knownNames.push_back(key);
531 hasKeys = iniFile->GetNextEntry(key, indexKey);
536 name = wxGetTextFromUser(_(
"Enter name of Enfuse setting"),
"Enfuse settings", name,
this);
544 name.Replace(
"=",
"",
true);
545 if (knownNames.Index(name) != wxNOT_FOUND)
547 if (
hugin_utils::HuginMessageBox(wxString::Format(_(
"Enfuse setting with name \"%s\" is already existing.\nShould it be overwritten?"), name),
548 _(
"Hugin toolbox"), wxYES_NO | wxICON_QUESTION,
this) == wxYES)
561 wxFileOutputStream iniStream(iniFilename.GetFullPath());
563 if (iniStream.IsOk())
565 success = iniFile->Save(iniStream);
569 hugin_utils::HuginMessageBox(wxString::Format(_(
"Could not save ini file \"%s\"."), iniFilename.GetFullPath()), _(
"Hugin toolbox"), wxOK | wxICON_ERROR,
this);
605 tempfile.SetExt(
"tif");
633 wxString exePath = wxFileName(wxStandardPaths::Get().GetExecutablePath()).GetPath(wxPATH_GET_VOLUME | wxPATH_GET_SEPARATOR);
646 exiftoolArgs.Append(
" -all:all --thumbnail --xposition --yposition --imagefullwidth --imagefullheight ");
660 wxConfigBase* config = wxConfigBase::Get();
661 wxString path = config->Read(
"/actualPath",
"");
662 wxFileDialog dlg(
this, _(
"Save output"), path, wxEmptyString,
GetMainImageFilters(), wxFD_SAVE | wxFD_OVERWRITE_PROMPT, wxDefaultPosition);
663 dlg.SetDirectory(path);
667 if (config->HasEntry(
"lastImageType"))
669 img_ext = config->Read(
"lastImageType").c_str();
671 if (img_ext ==
"jpg")
673 dlg.SetFilterIndex(0);
677 if (img_ext ==
"tiff")
679 dlg.SetFilterIndex(1);
683 if (img_ext ==
"png")
685 dlg.SetFilterIndex(2);
689 wxFileName outputfilename(
m_files[0]);
690 outputfilename.SetName(outputfilename.GetName() +
"_stacked");
691 dlg.SetFilename(outputfilename.GetFullPath());
693 if (dlg.ShowModal() == wxID_OK)
698 config->Write(
"/actualPath", dlg.GetDirectory());
700 switch (dlg.GetFilterIndex())
703 config->Write(
"lastImageType",
"jpg");
706 config->Write(
"lastImageType",
"tiff");
709 config->Write(
"lastImageType",
"png");
720 switch (e.GetSelection())
754 if (output.FileExists() && output.GetSize()>0)
772 wxPGProperty* prop =
m_enfuseOptions->Append(
new wxFloatProperty(
"Exposure weight",
"exposureWeight", 1));
773 prop->SetEditor(wxPGEditor_SpinCtrl);
774 prop->SetAttribute(wxPG_ATTR_MIN, 0);
775 prop->SetAttribute(wxPG_ATTR_MAX, 1);
776 prop->SetAttribute(wxPG_ATTR_SPINCTRL_STEP, 0.05);
777 prop =
m_enfuseOptions->Append(
new wxFloatProperty(
"Saturation weight",
"saturationWeight", 0));
778 prop->SetEditor(wxPGEditor_SpinCtrl);
779 prop->SetAttribute(wxPG_ATTR_MIN, 0);
780 prop->SetAttribute(wxPG_ATTR_MAX, 1);
781 prop->SetAttribute(wxPG_ATTR_SPINCTRL_STEP, 0.05);
782 prop =
m_enfuseOptions->Append(
new wxFloatProperty(
"Contrast weight",
"contrastWeight", 0));
783 prop->SetEditor(wxPGEditor_SpinCtrl);
784 prop->SetAttribute(wxPG_ATTR_MIN, 0);
785 prop->SetAttribute(wxPG_ATTR_MAX, 1);
786 prop =
m_enfuseOptions->Append(
new wxFloatProperty(
"Entropy weight",
"entropyWeight", 0));
787 prop->SetEditor(wxPGEditor_SpinCtrl);
788 prop->SetAttribute(wxPG_ATTR_MIN, 0);
789 prop->SetAttribute(wxPG_ATTR_MAX, 1);
790 prop->SetAttribute(wxPG_ATTR_SPINCTRL_STEP, 0.05);
792 m_enfuseOptions->Append(
new wxBoolProperty(
"Hard mask",
"hardMask",
false));
794 prop =
m_enfuseOptions->Append(
new wxPropertyCategory(_(
"General"),
"general"));
795 prop =
m_enfuseOptions->Append(
new wxIntProperty(
"Levels",
"levels", 0));
796 prop->SetEditor(wxPGEditor_SpinCtrl);
797 prop->SetAttribute(wxPG_ATTR_MIN, -29);
798 prop->SetAttribute(wxPG_ATTR_MAX, 29);
799 prop->SetAttribute(wxPG_ATTR_SPINCTRL_STEP, 1);
800 wxArrayString blendColorspaces;
801 blendColorspaces.Add(
"Auto");
802 blendColorspaces.Add(
"Identity (RGB)");
803 blendColorspaces.Add(
"CIELab");
804 blendColorspaces.Add(
"CIELuv");
805 blendColorspaces.Add(
"CIECAM02");
806 m_enfuseOptions->Append(
new wxEnumProperty(
"Blend colorspace",
"blendColorspace", blendColorspaces));
807 wxArrayString wrapMode;
808 wrapMode.Add(
"None");
809 wrapMode.Add(
"Horizontal");
810 wrapMode.Add(
"Vertical");
811 wrapMode.Add(
"Both");
812 m_enfuseOptions->Append(
new wxEnumProperty(
"Wrap mode",
"wrapMode", wrapMode));
814 m_enfuseOptions->Append(
new wxPropertyCategory(_(
"Fusions options"),
"fusionOptions"));
815 prop =
m_enfuseOptions->Append(
new wxFloatProperty(
"Exposure optimum",
"exposureOptimum", 0.5));
816 prop->SetEditor(wxPGEditor_SpinCtrl);
817 prop->SetAttribute(wxPG_ATTR_MIN, 0);
818 prop->SetAttribute(wxPG_ATTR_MAX, 1);
819 prop->SetAttribute(wxPG_ATTR_SPINCTRL_STEP, 0.05);
820 prop =
m_enfuseOptions->Append(
new wxFloatProperty(
"Exposure width",
"exposureWidth", 0.2));
821 prop->SetEditor(wxPGEditor_SpinCtrl);
822 prop->SetAttribute(wxPG_ATTR_MIN, 0);
823 prop->SetAttribute(wxPG_ATTR_MAX, 1);
824 prop->SetAttribute(wxPG_ATTR_SPINCTRL_STEP, 0.05);
825 prop =
m_enfuseOptions->Append(
new wxFloatProperty(
"Contrast edge scale",
"contrastEdgeScale", 0));
826 prop->SetEditor(wxPGEditor_SpinCtrl);
827 prop->SetAttribute(wxPG_ATTR_MIN, 0);
828 prop->SetAttribute(wxPG_ATTR_MAX, 5);
829 prop->SetAttribute(wxPG_ATTR_SPINCTRL_STEP, 0.1);
830 prop =
m_enfuseOptions->Append(
new wxFloatProperty(
"Contrast min curvature",
"contrastMinCurvature", 0));
831 prop->SetEditor(wxPGEditor_SpinCtrl);
832 prop->SetAttribute(wxPG_ATTR_MIN, 0);
833 prop->SetAttribute(wxPG_ATTR_MAX, 50);
834 prop->SetAttribute(wxPG_ATTR_SPINCTRL_STEP, 0.5);
835 prop =
m_enfuseOptions->Append(
new wxIntProperty(
"Contrast window size",
"contrastWindowSize", 5));
836 prop->SetEditor(wxPGEditor_SpinCtrl);
837 prop->SetAttribute(wxPG_ATTR_MIN, 3);
838 prop->SetAttribute(wxPG_ATTR_MAX, 30);
839 prop->SetAttribute(wxPG_ATTR_SPINCTRL_STEP, 1);
840 prop =
m_enfuseOptions->Append(
new wxFloatProperty(
"Entropy lower cutoff",
"entropyLowerCutoff", 0));
841 prop->SetEditor(wxPGEditor_SpinCtrl);
842 prop->SetAttribute(wxPG_ATTR_MIN, 0);
843 prop->SetAttribute(wxPG_ATTR_MAX, 100);
844 prop->SetAttribute(wxPG_ATTR_SPINCTRL_STEP, 0.5);
845 prop =
m_enfuseOptions->Append(
new wxFloatProperty(
"Entropy higher cutoff",
"entropyUpperCutoff", 100));
846 prop->SetEditor(wxPGEditor_SpinCtrl);
847 prop->SetAttribute(wxPG_ATTR_MIN, 0);
848 prop->SetAttribute(wxPG_ATTR_MAX, 100);
849 prop->SetAttribute(wxPG_ATTR_SPINCTRL_STEP, 0.5);
850 prop =
m_enfuseOptions->Append(
new wxIntProperty(
"Entropy window size",
"entropyWindowSize", 3));
851 prop->SetEditor(wxPGEditor_SpinCtrl);
852 prop->SetAttribute(wxPG_ATTR_MIN, 3);
853 prop->SetAttribute(wxPG_ATTR_MAX, 7);
854 prop->SetAttribute(wxPG_ATTR_SPINCTRL_STEP, 1);
855 prop =
m_enfuseOptions->Append(
new wxFloatProperty(
"Expoure lower cutoff",
"exposureLowerCutoff", 0));
856 prop->SetEditor(wxPGEditor_SpinCtrl);
857 prop->SetAttribute(wxPG_ATTR_MIN, 0);
858 prop->SetAttribute(wxPG_ATTR_MAX, 100);
859 prop->SetAttribute(wxPG_ATTR_SPINCTRL_STEP, 0.5);
860 prop =
m_enfuseOptions->Append(
new wxFloatProperty(
"Exposure higher cutoff",
"exposureUpperCutoff", 100));
861 prop->SetEditor(wxPGEditor_SpinCtrl);
862 prop->SetAttribute(wxPG_ATTR_MIN, 0);
863 prop->SetAttribute(wxPG_ATTR_MAX, 100);
864 prop->SetAttribute(wxPG_ATTR_SPINCTRL_STEP, 0.5);
865 wxArrayString exposureWeightFunction;
866 exposureWeightFunction.Add(
"Gaussian");
867 exposureWeightFunction.Add(
"Lorentzian");
868 exposureWeightFunction.Add(
"Half-sine");
869 exposureWeightFunction.Add(
"Full-sine");
870 exposureWeightFunction.Add(
"Bi-square");
871 m_enfuseOptions->Append(
new wxEnumProperty(
"Exposure weight function",
"exposureWeightFunction", exposureWeightFunction));
872 wxArrayString grayProjector;
873 grayProjector.Add(
"anti-value");
874 grayProjector.Add(
"Average");
875 grayProjector.Add(
"L-channel from Lab (gamma=1)");
876 grayProjector.Add(
"L-channel from Lab (gamma corrected)");
877 grayProjector.Add(
"Lightness");
878 grayProjector.Add(
"Luminance");
879 grayProjector.Add(
"Value from HSV");
881 prop =
m_enfuseOptions->Append(
new wxEnumProperty(
"Gray projector",
"grayProjector", grayProjector));
888 wxString commandline(
"--verbose ");
889 double doubleValue=
m_enfuseOptions->GetPropertyValueAsDouble(
"exposureWeight");
890 if (doubleValue != 1)
892 commandline.Append(
" --exposure-weight=" + wxString::FromCDouble(doubleValue));
894 doubleValue =
m_enfuseOptions->GetPropertyValueAsDouble(
"saturationWeight");
895 if (doubleValue != 0)
897 commandline.Append(
" --saturation-weight=" + wxString::FromCDouble(doubleValue));
899 doubleValue =
m_enfuseOptions->GetPropertyValueAsDouble(
"contrastWeight");
900 if (doubleValue != 0)
902 commandline.Append(
" --contrast-weight=" + wxString::FromCDouble(doubleValue));
904 doubleValue =
m_enfuseOptions->GetPropertyValueAsDouble(
"entropyWeight");
905 if (doubleValue != 0)
907 commandline.Append(
" --entropy-weight=" + wxString::FromCDouble(doubleValue));
912 commandline.Append(
" --hard-mask");
917 commandline.Append(wxString::Format(
" --level=%d", intValue));
923 commandline.Append(
" --blend-colorspace=identity");
926 commandline.Append(
" --blend-colorspace=cielab");
929 commandline.Append(
" --blend-colorspace=cieluv");
932 commandline.Append(
" --blend-colorspace=ciecam");
943 commandline.Append(
" --wrap=horizontal");
946 commandline.Append(
" --wrap=vertical");
949 commandline.Append(
" --wrap=both ");
955 doubleValue =
m_enfuseOptions->GetPropertyValueAsDouble(
"exposureOptimum");
956 if (doubleValue != 0.5)
958 commandline.Append(
" --exposure-optimum=" + wxString::FromCDouble(doubleValue));
960 doubleValue =
m_enfuseOptions->GetPropertyValueAsDouble(
"exposureWidth");
961 if (doubleValue != 0.2)
963 commandline.Append(
" --exposure-width=" + wxString::FromCDouble(doubleValue));
965 doubleValue =
m_enfuseOptions->GetPropertyValueAsDouble(
"contrastEdgeScale");
966 if (doubleValue != 0)
968 commandline.Append(
" --contrast-edge-scale=" + wxString::FromCDouble(doubleValue));
970 doubleValue =
m_enfuseOptions->GetPropertyValueAsDouble(
"contrastMinCurvature");
971 if (doubleValue != 0)
973 commandline.Append(
" --contrast-min-curvature=" + wxString::FromCDouble(doubleValue) +
"%");
975 intValue =
m_enfuseOptions->GetPropertyValueAsInt(
"contrastWindowSize");
978 commandline.Append(wxString::Format(
" --contrast-window-size=%d", intValue));
981 doubleValue =
m_enfuseOptions->GetPropertyValueAsDouble(
"entropyLowerCutoff");
982 double doubleValue2 =
m_enfuseOptions->GetPropertyValueAsDouble(
"entropyUpperCutoff");
983 if (doubleValue > 0 || doubleValue2 < 100)
985 commandline.Append(
" --entropy-cutoff=" + wxString::FromCDouble(doubleValue) +
"%");
986 if (doubleValue2 < 100)
988 commandline.Append(
":" + wxString::FromCDouble(doubleValue2) +
"%");
991 intValue =
m_enfuseOptions->GetPropertyValueAsInt(
"entropyWindowSize");
994 commandline.Append(wxString::Format(
" --entropy-window-size=%d", intValue));
997 doubleValue =
m_enfuseOptions->GetPropertyValueAsDouble(
"exposureLowerCutoff");
998 doubleValue2 =
m_enfuseOptions->GetPropertyValueAsDouble(
"exposureUpperCutoff");
999 if (doubleValue > 0 || doubleValue2 < 100)
1001 commandline.Append(
" --exposure-cutoff=" + wxString::FromCDouble(doubleValue) +
"%");
1002 if (doubleValue2 < 100)
1004 commandline.Append(
":" + wxString::FromCDouble(doubleValue2) +
"%");
1008 intValue =
m_enfuseOptions->GetPropertyValueAsInt(
"exposureWeightFunction");
1012 commandline.Append(
" --exposure-weight-function=lorentz");
1015 commandline.Append(
" --exposure-weight-function=halfsine");
1018 commandline.Append(
" --exposure-weight-function=fullsine");
1021 commandline.Append(
" --exposure-weight-function=bisquare");
1032 commandline.Append(
" --gray-projector=anti-value");
1035 commandline.Append(
" --gray-projector=al-star");
1038 commandline.Append(
" --gray-projector=pl-star");
1041 commandline.Append(
" --gray-projector=lightness");
1044 commandline.Append(
" --gray-projector=luminance");
1047 commandline.Append(
" --gray-projector=value");
1060 commandline.Append(
" ");
1063 wxArrayInt selectedFiles;
1068 selectedFiles.push_back(i);
1071 if (selectedFiles.IsEmpty())
1074 return wxEmptyString;
1076 for (
int i = 0; i < selectedFiles.size(); ++i)
1078 commandline.Append(
" ");
1087 XRCCTRL(*
this,
"enfuse_remove_file", wxButton)->Enable(
m_fileListCtrl->GetSelectedItemCount() >= 1);
1088 XRCCTRL(*
this,
"enfuse_create_file", wxButton)->Enable(
m_fileListCtrl->GetSelectedItemCount() == 1);
1107 XRCCTRL(*
this,
"enfuse_preview", wxButton)->Enable(enable);
1108 XRCCTRL(*
this,
"enfuse_enfuse", wxButton)->Enable(enable);
int ExecWithRedirect(wxString command)
EnfusePanel * m_enfusePanel
normal command for queue, processing is stopped if an error occurred in program
void OnSize(wxSizeEvent &e)
event handler
void OnAddFiles(wxCommandEvent &e)
const wxString GetConfigTempDir(const wxConfigBase *config)
return the temp dir from the preferences, ensure that it ends with path separator ...
void OnRemoveFile(wxCommandEvent &e)
Dialog for create brighter and/or darker versions of an image.
MyExecPanel * m_logWindow
long GetCheckedItemCount() const
return the number of check images
optional command for queue, processing of queue is always continued, also if an error occurred ...
void OnSelectAllFiles(wxKeyEvent &e)
void OnZoom(wxCommandEvent &e)
void ExecuteEnfuse()
build the command line and execute enfuse command
void OnGeneratePreview(wxCommandEvent &e)
void OnCreateFile(wxCommandEvent &e)
void EnableOutputButtons(bool enable)
enable/disable output buttons
int ExecQueue(HuginQueue::CommandQueue *queue)
void ClearOutput()
clear the output
void OnFileCheckStateChanged(wxCommandEvent &e)
file drag and drop handler method
vigra::pair< typename ROIImage< Image, Mask >::image_const_traverser, typename ROIImage< Image, Mask >::ImageConstAccessor > srcImage(const ROIImage< Image, Mask > &img)
static const wxString defaultIni
default ini, if no one exists load this one
basic classes and function for queuing commands in wxWidgets
std::set< unsigned int > UIntSet
bool SetImage(const wxString &filename, wxString &errorMsg)
load the image, return true on success, otherwise false, error cause is in errorMsg ...
void EnableFileButtons()
enable/disable the file(s) remove and create buttons depending on selection of wxListCtrl ...
void AddFile(const wxString &filename)
adds the given file to the list
void setImage(const wxString &filename)
set the current image and mask list, this loads also the image from cache
PreviewWindow * m_preview
void OnLoadSetting(wxCommandEvent &e)
void ExecuteEnfuseExiftool()
build the command line and execute enfuse and exiftool afterwards
bool Create(wxWindow *parent, wxWindowID id=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxTAB_TRAVERSAL, const wxString &name="panel")
create the control
wxListCtrl * m_fileListCtrl
IMPLEMENT_DYNAMIC_CLASS(wxTreeListHeaderWindow, wxWindow)
Definition of dialog class to create brighter/darker versions of the image.
void OnFileSelectionChanged(wxCommandEvent &e)
void AddString(const wxString &s)
display the string in the panel
void CleanUpTempFiles()
delete all temporary files, to be called mainly at end
declaration of panel for enfuse GUI
bool Create(wxWindow *parent, MyExecPanel *logPanel)
creates the control and populates all controls with their settings
void OnSaveSetting(wxCommandEvent &e)
void PopulateEnfuseOptions()
fill the PropertyGrid with all enfuse options
wxString GetPropertyGridContent(const wxPropertyGrid *grid)
wxArrayString m_tempFiles
void setScale(double factor)
set the scaling factor f.
void OnProcessFinished(wxCommandEvent &e)
call at the end of the enfuse command, to load result back and enable buttons again ...
str wxEscapeFilename(const str &arg)
special escaping routine for CommandQueues
~EnfusePanel()
destructor, save state and settings
std::string GetUserAppDataDir()
returns the directory for user specific Hugin settings, e.g.
bool readEXIF()
try to fill out information about the image, by examining the exif data
wxString GetEnfuseCommandLine()
get the full commandline for enfuse without program, but with files and output options, the output filename is read from m_outputFilename
bool OnDropFiles(wxCoord x, wxCoord y, const wxArrayString &filenames)
void SetPropertyGridContent(wxPropertyGrid *grid, const wxString values)
void OnResetSetting(wxCommandEvent &e)
EnfuseDropTarget(EnfusePanel *parent)
wxFileConfig * ReadIni(const wxString &filename)
wxPropertyGrid * m_enfuseOptions
str wxQuoteFilename(const str &arg)
Quote a filename, so that it is surrounded by "".
wxArrayString m_outputFilenames
All variables of a source image.
int HuginMessageBox(const wxString &message, const wxString &caption, int style, wxWindow *parent)
wxString GetEnfuseOptions()
build string with all enfuse options from values in wxPropertyGrid this are the mainly the fusion opt...
wxString GetExternalProgram(wxConfigBase *config, const wxString &bindir, const wxString &name)
return path and name of external program, which can be overwritten by the user
std::vector< NormalCommand * > CommandQueue
void OnGenerateOutput(wxCommandEvent &e)
wxArrayString GetTempFiles() const