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/Enfuse/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/Enfuse/FileListColumnWidth%d", j), -1);
284 wxFileName fullFilename(filename);
304 wxConfigBase* config = wxConfigBase::Get();
305 wxString path = config->Read(
"/actualPath",
"");
306 wxFileDialog dlg(
this, _(
"Add images"), path, wxEmptyString,
308 dlg.SetDirectory(path);
312 if (config->HasEntry(
"lastImageType"))
314 img_ext = config->Read(
"lastImageType").c_str();
316 if (img_ext ==
"all images")
317 dlg.SetFilterIndex(0);
318 else if (img_ext ==
"jpg")
319 dlg.SetFilterIndex(1);
320 else if (img_ext ==
"tiff")
321 dlg.SetFilterIndex(2);
322 else if (img_ext ==
"png")
323 dlg.SetFilterIndex(3);
324 else if (img_ext ==
"hdr")
325 dlg.SetFilterIndex(4);
326 else if (img_ext ==
"exr")
327 dlg.SetFilterIndex(5);
328 else if (img_ext ==
"all files")
329 dlg.SetFilterIndex(6);
332 if (dlg.ShowModal() == wxID_OK)
335 wxArrayString Pathnames;
336 dlg.GetPaths(Pathnames);
338 config->Write(
"/actualPath", dlg.GetDirectory());
340 switch (dlg.GetFilterIndex())
342 case 0: config->Write(
"lastImageType",
"all images");
break;
343 case 1: config->Write(
"lastImageType",
"jpg");
break;
344 case 2: config->Write(
"lastImageType",
"tiff");
break;
345 case 3: config->Write(
"lastImageType",
"png");
break;
346 case 4: config->Write(
"lastImageType",
"hdr");
break;
347 case 5: config->Write(
"lastImageType",
"exr");
break;
348 case 6: config->Write(
"lastImageType",
"all files");
break;
350 for (
auto& f : Pathnames)
364 if (
m_fileListCtrl->GetItemState(i, wxLIST_STATE_SELECTED) & wxLIST_STATE_SELECTED)
370 if (!selected.empty())
373 for (
auto i = selected.rbegin(); i != selected.rend(); ++i)
375 if (*i >= 0 && *i <
m_files.size())
395 long index =
m_fileListCtrl->GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
402 if (dlg.ShowModal() == wxID_OK)
408 for (
const auto& f : newFiles)
432 if (e.GetKeyCode() == 1 && e.CmdDown())
437 m_fileListCtrl->SetItemState(i, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED);
441 if ((e.GetKeyCode() == WXK_INSERT || e.GetKeyCode() == WXK_NUMPAD_INSERT) && !e.HasAnyModifiers())
443 wxCommandEvent e(wxEVT_BUTTON);
444 e.SetId(XRCID(
"enfuse_add_file"));
445 this->GetEventHandler()->AddPendingEvent(e);
448 if ((e.GetKeyCode() == WXK_DELETE || e.GetKeyCode() == WXK_NUMPAD_DELETE) && !e.HasAnyModifiers())
452 wxCommandEvent e(wxEVT_BUTTON);
453 e.SetId(XRCID(
"enfuse_remove_file"));
454 this->GetEventHandler()->AddPendingEvent(e);
478 "[Enfuse_Settings]\n"
479 "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"
480 "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"
483 wxFileConfig*
ReadIni(
const wxString& filename)
485 wxInputStream* iniStream{
nullptr };
486 if (wxFileExists(filename))
488 iniStream =
new wxFileInputStream(filename);
489 if (!iniStream->IsOk())
495 if (iniStream ==
nullptr)
497 iniStream =
new wxStringInputStream(
defaultIni);
500 wxFileConfig* iniFile=
new wxFileConfig(*iniStream);
508 wxFileConfig* iniFile =
ReadIni(iniFilename.GetFullPath());
510 iniFile->SetPath(
"Enfuse_Settings");
511 wxArrayString knownNames;
512 wxArrayString knownSettings;
515 bool hasKeys = iniFile->GetFirstEntry(key, indexKey);
518 knownNames.push_back(key);
519 knownSettings.push_back(iniFile->Read(key));
520 hasKeys = iniFile->GetNextEntry(key, indexKey);
522 int selection=wxGetSingleChoiceIndex(_(
"Select the Enfuse setting, which should be loaded."), _(
"Hugin toolbox"), knownNames, 0,
this);
533 wxFileConfig* iniFile =
ReadIni(iniFilename.GetFullPath());
535 iniFile->SetPath(
"Enfuse_Settings");
536 wxArrayString knownNames;
539 bool hasKeys = iniFile->GetFirstEntry(key, indexKey);
542 knownNames.push_back(key);
543 hasKeys = iniFile->GetNextEntry(key, indexKey);
548 name = wxGetTextFromUser(_(
"Enter name of Enfuse setting"),
"Enfuse settings", name,
this);
556 name.Replace(
"=",
"",
true);
557 if (knownNames.Index(name) != wxNOT_FOUND)
559 if (
hugin_utils::HuginMessageBox(wxString::Format(_(
"Enfuse setting with name \"%s\" is already existing.\nShould it be overwritten?"), name),
560 _(
"Hugin toolbox"), wxYES_NO | wxICON_QUESTION,
this) == wxYES)
573 wxFileOutputStream iniStream(iniFilename.GetFullPath());
575 if (iniStream.IsOk())
577 success = iniFile->Save(iniStream);
581 hugin_utils::HuginMessageBox(wxString::Format(_(
"Could not save ini file \"%s\"."), iniFilename.GetFullPath()), _(
"Hugin toolbox"), wxOK | wxICON_ERROR,
this);
617 tempfile.SetExt(
"tif");
645 wxString exePath = wxFileName(wxStandardPaths::Get().GetExecutablePath()).GetPath(wxPATH_GET_VOLUME | wxPATH_GET_SEPARATOR);
658 exiftoolArgs.Append(
" -all:all --thumbnail --thumbnailimage --xposition --yposition --imagefullwidth --imagefullheight ");
672 wxConfigBase* config = wxConfigBase::Get();
673 wxString path = config->Read(
"/actualPath",
"");
674 wxFileDialog dlg(
this, _(
"Save output"), path, wxEmptyString,
GetMainImageFilters(), wxFD_SAVE | wxFD_OVERWRITE_PROMPT, wxDefaultPosition);
675 dlg.SetDirectory(path);
679 if (config->HasEntry(
"lastImageType"))
681 img_ext = config->Read(
"lastImageType").c_str();
683 if (img_ext ==
"jpg")
685 dlg.SetFilterIndex(0);
689 if (img_ext ==
"tiff")
691 dlg.SetFilterIndex(1);
695 if (img_ext ==
"png")
697 dlg.SetFilterIndex(2);
701 wxFileName outputfilename(
m_files[0]);
702 outputfilename.SetName(outputfilename.GetName() +
"_stacked");
703 dlg.SetFilename(outputfilename.GetFullPath());
705 if (dlg.ShowModal() == wxID_OK)
710 config->Write(
"/actualPath", dlg.GetDirectory());
712 switch (dlg.GetFilterIndex())
715 config->Write(
"lastImageType",
"jpg");
718 config->Write(
"lastImageType",
"tiff");
721 config->Write(
"lastImageType",
"png");
732 switch (e.GetSelection())
766 if (output.FileExists() && output.GetSize()>0)
784 wxPGProperty* prop =
m_enfuseOptions->Append(
new wxFloatProperty(
"Exposure weight",
"exposureWeight", 1));
785 prop->SetEditor(wxPGEditor_SpinCtrl);
786 prop->SetAttribute(wxPG_ATTR_MIN, 0);
787 prop->SetAttribute(wxPG_ATTR_MAX, 1);
788 prop->SetAttribute(wxPG_ATTR_SPINCTRL_STEP, 0.05);
789 prop =
m_enfuseOptions->Append(
new wxFloatProperty(
"Saturation weight",
"saturationWeight", 0));
790 prop->SetEditor(wxPGEditor_SpinCtrl);
791 prop->SetAttribute(wxPG_ATTR_MIN, 0);
792 prop->SetAttribute(wxPG_ATTR_MAX, 1);
793 prop->SetAttribute(wxPG_ATTR_SPINCTRL_STEP, 0.05);
794 prop =
m_enfuseOptions->Append(
new wxFloatProperty(
"Contrast weight",
"contrastWeight", 0));
795 prop->SetEditor(wxPGEditor_SpinCtrl);
796 prop->SetAttribute(wxPG_ATTR_MIN, 0);
797 prop->SetAttribute(wxPG_ATTR_MAX, 1);
798 prop =
m_enfuseOptions->Append(
new wxFloatProperty(
"Entropy weight",
"entropyWeight", 0));
799 prop->SetEditor(wxPGEditor_SpinCtrl);
800 prop->SetAttribute(wxPG_ATTR_MIN, 0);
801 prop->SetAttribute(wxPG_ATTR_MAX, 1);
802 prop->SetAttribute(wxPG_ATTR_SPINCTRL_STEP, 0.05);
804 m_enfuseOptions->Append(
new wxBoolProperty(
"Hard mask",
"hardMask",
false));
806 prop =
m_enfuseOptions->Append(
new wxPropertyCategory(_(
"General"),
"general"));
807 prop =
m_enfuseOptions->Append(
new wxIntProperty(
"Levels",
"levels", 0));
808 prop->SetEditor(wxPGEditor_SpinCtrl);
809 prop->SetAttribute(wxPG_ATTR_MIN, -29);
810 prop->SetAttribute(wxPG_ATTR_MAX, 29);
811 prop->SetAttribute(wxPG_ATTR_SPINCTRL_STEP, 1);
812 wxArrayString blendColorspaces;
813 blendColorspaces.Add(
"Auto");
814 blendColorspaces.Add(
"Identity (RGB)");
815 blendColorspaces.Add(
"CIELab");
816 blendColorspaces.Add(
"CIELuv");
817 blendColorspaces.Add(
"CIECAM02");
818 m_enfuseOptions->Append(
new wxEnumProperty(
"Blend colorspace",
"blendColorspace", blendColorspaces));
819 wxArrayString wrapMode;
820 wrapMode.Add(
"None");
821 wrapMode.Add(
"Horizontal");
822 wrapMode.Add(
"Vertical");
823 wrapMode.Add(
"Both");
824 m_enfuseOptions->Append(
new wxEnumProperty(
"Wrap mode",
"wrapMode", wrapMode));
826 m_enfuseOptions->Append(
new wxPropertyCategory(_(
"Fusions options"),
"fusionOptions"));
827 prop =
m_enfuseOptions->Append(
new wxFloatProperty(
"Exposure optimum",
"exposureOptimum", 0.5));
828 prop->SetEditor(wxPGEditor_SpinCtrl);
829 prop->SetAttribute(wxPG_ATTR_MIN, 0);
830 prop->SetAttribute(wxPG_ATTR_MAX, 1);
831 prop->SetAttribute(wxPG_ATTR_SPINCTRL_STEP, 0.05);
832 prop =
m_enfuseOptions->Append(
new wxFloatProperty(
"Exposure width",
"exposureWidth", 0.2));
833 prop->SetEditor(wxPGEditor_SpinCtrl);
834 prop->SetAttribute(wxPG_ATTR_MIN, 0);
835 prop->SetAttribute(wxPG_ATTR_MAX, 1);
836 prop->SetAttribute(wxPG_ATTR_SPINCTRL_STEP, 0.05);
837 prop =
m_enfuseOptions->Append(
new wxFloatProperty(
"Contrast edge scale",
"contrastEdgeScale", 0));
838 prop->SetEditor(wxPGEditor_SpinCtrl);
839 prop->SetAttribute(wxPG_ATTR_MIN, 0);
840 prop->SetAttribute(wxPG_ATTR_MAX, 5);
841 prop->SetAttribute(wxPG_ATTR_SPINCTRL_STEP, 0.1);
842 prop =
m_enfuseOptions->Append(
new wxFloatProperty(
"Contrast min curvature",
"contrastMinCurvature", 0));
843 prop->SetEditor(wxPGEditor_SpinCtrl);
844 prop->SetAttribute(wxPG_ATTR_MIN, 0);
845 prop->SetAttribute(wxPG_ATTR_MAX, 50);
846 prop->SetAttribute(wxPG_ATTR_SPINCTRL_STEP, 0.5);
847 prop =
m_enfuseOptions->Append(
new wxIntProperty(
"Contrast window size",
"contrastWindowSize", 5));
848 prop->SetEditor(wxPGEditor_SpinCtrl);
849 prop->SetAttribute(wxPG_ATTR_MIN, 3);
850 prop->SetAttribute(wxPG_ATTR_MAX, 30);
851 prop->SetAttribute(wxPG_ATTR_SPINCTRL_STEP, 1);
852 prop =
m_enfuseOptions->Append(
new wxFloatProperty(
"Entropy lower cutoff",
"entropyLowerCutoff", 0));
853 prop->SetEditor(wxPGEditor_SpinCtrl);
854 prop->SetAttribute(wxPG_ATTR_MIN, 0);
855 prop->SetAttribute(wxPG_ATTR_MAX, 100);
856 prop->SetAttribute(wxPG_ATTR_SPINCTRL_STEP, 0.5);
857 prop =
m_enfuseOptions->Append(
new wxFloatProperty(
"Entropy higher cutoff",
"entropyUpperCutoff", 100));
858 prop->SetEditor(wxPGEditor_SpinCtrl);
859 prop->SetAttribute(wxPG_ATTR_MIN, 0);
860 prop->SetAttribute(wxPG_ATTR_MAX, 100);
861 prop->SetAttribute(wxPG_ATTR_SPINCTRL_STEP, 0.5);
862 prop =
m_enfuseOptions->Append(
new wxIntProperty(
"Entropy window size",
"entropyWindowSize", 3));
863 prop->SetEditor(wxPGEditor_SpinCtrl);
864 prop->SetAttribute(wxPG_ATTR_MIN, 3);
865 prop->SetAttribute(wxPG_ATTR_MAX, 7);
866 prop->SetAttribute(wxPG_ATTR_SPINCTRL_STEP, 1);
867 prop =
m_enfuseOptions->Append(
new wxFloatProperty(
"Expoure lower cutoff",
"exposureLowerCutoff", 0));
868 prop->SetEditor(wxPGEditor_SpinCtrl);
869 prop->SetAttribute(wxPG_ATTR_MIN, 0);
870 prop->SetAttribute(wxPG_ATTR_MAX, 100);
871 prop->SetAttribute(wxPG_ATTR_SPINCTRL_STEP, 0.5);
872 prop =
m_enfuseOptions->Append(
new wxFloatProperty(
"Exposure higher cutoff",
"exposureUpperCutoff", 100));
873 prop->SetEditor(wxPGEditor_SpinCtrl);
874 prop->SetAttribute(wxPG_ATTR_MIN, 0);
875 prop->SetAttribute(wxPG_ATTR_MAX, 100);
876 prop->SetAttribute(wxPG_ATTR_SPINCTRL_STEP, 0.5);
877 wxArrayString exposureWeightFunction;
878 exposureWeightFunction.Add(
"Gaussian");
879 exposureWeightFunction.Add(
"Lorentzian");
880 exposureWeightFunction.Add(
"Half-sine");
881 exposureWeightFunction.Add(
"Full-sine");
882 exposureWeightFunction.Add(
"Bi-square");
883 m_enfuseOptions->Append(
new wxEnumProperty(
"Exposure weight function",
"exposureWeightFunction", exposureWeightFunction));
884 wxArrayString grayProjector;
885 grayProjector.Add(
"anti-value");
886 grayProjector.Add(
"Average");
887 grayProjector.Add(
"L-channel from Lab (gamma=1)");
888 grayProjector.Add(
"L-channel from Lab (gamma corrected)");
889 grayProjector.Add(
"Lightness");
890 grayProjector.Add(
"Luminance");
891 grayProjector.Add(
"Value from HSV");
893 prop =
m_enfuseOptions->Append(
new wxEnumProperty(
"Gray projector",
"grayProjector", grayProjector));
900 wxString commandline(
"--verbose ");
901 double doubleValue=
m_enfuseOptions->GetPropertyValueAsDouble(
"exposureWeight");
902 if (doubleValue != 1)
904 commandline.Append(
" --exposure-weight=" + wxString::FromCDouble(doubleValue));
906 doubleValue =
m_enfuseOptions->GetPropertyValueAsDouble(
"saturationWeight");
907 if (doubleValue != 0)
909 commandline.Append(
" --saturation-weight=" + wxString::FromCDouble(doubleValue));
911 doubleValue =
m_enfuseOptions->GetPropertyValueAsDouble(
"contrastWeight");
912 if (doubleValue != 0)
914 commandline.Append(
" --contrast-weight=" + wxString::FromCDouble(doubleValue));
916 doubleValue =
m_enfuseOptions->GetPropertyValueAsDouble(
"entropyWeight");
917 if (doubleValue != 0)
919 commandline.Append(
" --entropy-weight=" + wxString::FromCDouble(doubleValue));
924 commandline.Append(
" --hard-mask");
929 commandline.Append(wxString::Format(
" --level=%d", intValue));
935 commandline.Append(
" --blend-colorspace=identity");
938 commandline.Append(
" --blend-colorspace=cielab");
941 commandline.Append(
" --blend-colorspace=cieluv");
944 commandline.Append(
" --blend-colorspace=ciecam");
955 commandline.Append(
" --wrap=horizontal");
958 commandline.Append(
" --wrap=vertical");
961 commandline.Append(
" --wrap=both ");
967 doubleValue =
m_enfuseOptions->GetPropertyValueAsDouble(
"exposureOptimum");
968 if (doubleValue != 0.5)
970 commandline.Append(
" --exposure-optimum=" + wxString::FromCDouble(doubleValue));
972 doubleValue =
m_enfuseOptions->GetPropertyValueAsDouble(
"exposureWidth");
973 if (doubleValue != 0.2)
975 commandline.Append(
" --exposure-width=" + wxString::FromCDouble(doubleValue));
977 doubleValue =
m_enfuseOptions->GetPropertyValueAsDouble(
"contrastEdgeScale");
978 if (doubleValue != 0)
980 commandline.Append(
" --contrast-edge-scale=" + wxString::FromCDouble(doubleValue));
982 doubleValue =
m_enfuseOptions->GetPropertyValueAsDouble(
"contrastMinCurvature");
983 if (doubleValue != 0)
985 commandline.Append(
" --contrast-min-curvature=" + wxString::FromCDouble(doubleValue) +
"%");
987 intValue =
m_enfuseOptions->GetPropertyValueAsInt(
"contrastWindowSize");
990 commandline.Append(wxString::Format(
" --contrast-window-size=%d", intValue));
993 doubleValue =
m_enfuseOptions->GetPropertyValueAsDouble(
"entropyLowerCutoff");
994 double doubleValue2 =
m_enfuseOptions->GetPropertyValueAsDouble(
"entropyUpperCutoff");
995 if (doubleValue > 0 || doubleValue2 < 100)
997 commandline.Append(
" --entropy-cutoff=" + wxString::FromCDouble(doubleValue) +
"%");
998 if (doubleValue2 < 100)
1000 commandline.Append(
":" + wxString::FromCDouble(doubleValue2) +
"%");
1003 intValue =
m_enfuseOptions->GetPropertyValueAsInt(
"entropyWindowSize");
1006 commandline.Append(wxString::Format(
" --entropy-window-size=%d", intValue));
1009 doubleValue =
m_enfuseOptions->GetPropertyValueAsDouble(
"exposureLowerCutoff");
1010 doubleValue2 =
m_enfuseOptions->GetPropertyValueAsDouble(
"exposureUpperCutoff");
1011 if (doubleValue > 0 || doubleValue2 < 100)
1013 commandline.Append(
" --exposure-cutoff=" + wxString::FromCDouble(doubleValue) +
"%");
1014 if (doubleValue2 < 100)
1016 commandline.Append(
":" + wxString::FromCDouble(doubleValue2) +
"%");
1020 intValue =
m_enfuseOptions->GetPropertyValueAsInt(
"exposureWeightFunction");
1024 commandline.Append(
" --exposure-weight-function=lorentz");
1027 commandline.Append(
" --exposure-weight-function=halfsine");
1030 commandline.Append(
" --exposure-weight-function=fullsine");
1033 commandline.Append(
" --exposure-weight-function=bisquare");
1044 commandline.Append(
" --gray-projector=anti-value");
1047 commandline.Append(
" --gray-projector=al-star");
1050 commandline.Append(
" --gray-projector=pl-star");
1053 commandline.Append(
" --gray-projector=lightness");
1056 commandline.Append(
" --gray-projector=luminance");
1059 commandline.Append(
" --gray-projector=value");
1072 commandline.Append(
" ");
1075 wxArrayInt selectedFiles;
1080 selectedFiles.push_back(i);
1083 if (selectedFiles.IsEmpty())
1086 return wxEmptyString;
1088 for (
int i = 0; i < selectedFiles.size(); ++i)
1090 commandline.Append(
" ");
1099 XRCCTRL(*
this,
"enfuse_remove_file", wxButton)->Enable(
m_fileListCtrl->GetSelectedItemCount() >= 1);
1100 XRCCTRL(*
this,
"enfuse_create_file", wxButton)->Enable(
m_fileListCtrl->GetSelectedItemCount() == 1);
1119 XRCCTRL(*
this,
"enfuse_preview", wxButton)->Enable(enable);
1120 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 OnAddFiles(wxCommandEvent &e)
event handler
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 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 OnFileListChar(wxKeyEvent &e)
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