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>
50 bool OnDropFiles(wxCoord x, wxCoord y,
const wxArrayString& filenames)
54 for (
unsigned int i = 0; i < filenames.GetCount(); i++)
56 wxFileName file(filenames[i]);
57 if (file.GetExt().CmpNoCase(
"jpg") == 0 ||
58 file.GetExt().CmpNoCase(
"jpeg") == 0 ||
59 file.GetExt().CmpNoCase(
"tif") == 0 ||
60 file.GetExt().CmpNoCase(
"tiff") == 0 ||
61 file.GetExt().CmpNoCase(
"png") == 0 ||
62 file.GetExt().CmpNoCase(
"bmp") == 0 ||
63 file.GetExt().CmpNoCase(
"gif") == 0 ||
64 file.GetExt().CmpNoCase(
"pnm") == 0 ||
65 file.GetExt().CmpNoCase(
"sun") == 0 ||
66 file.GetExt().CmpNoCase(
"hdr") == 0 ||
67 file.GetExt().CmpNoCase(
"viff") == 0)
69 files.push_back(file.GetFullPath());
89 wxArrayString properties = wxStringTokenize(values,
"|");
90 for (
size_t i = 0; i < properties.size(); ++i)
92 wxArrayString prop = wxStringTokenize(properties[i],
":");
95 if (prop[1] ==
"double")
98 if (prop[2].ToCDouble(&doubleVal))
100 grid->SetPropertyValue(prop[0], doubleVal);
105 if (prop[1] ==
"long")
108 if (prop[2].ToLong(&longVal))
110 grid->SetPropertyValue(prop[0], longVal);
115 if (prop[1] ==
"bool")
117 if (prop[2] ==
"true")
119 grid->SetPropertyValue(prop[0],
true);
123 grid->SetPropertyValue(prop[0],
false);
139 wxPropertyGridConstIterator it;
141 for (it = grid->GetIterator(); !it.AtEnd(); it++)
143 const wxPGProperty* p = *it;
149 if (!output.IsEmpty())
153 const wxString type = p->GetValueType();
154 output.Append(p->GetName() +
":");
155 if (type ==
"double")
157 output.Append(
"double:" + wxString::FromCDouble(p->GetValue().GetDouble()));
163 output.Append(
"long:" + wxString::FromCDouble(p->GetValue().GetLong()));
169 if (p->GetValue().GetBool())
171 output.Append(
"bool:true");
175 output.Append(
"bool:false");
192 wxConfigBase* config = wxConfigBase::Get();
193 config->Write(
"/ToolboxFrame/Enfuse_Splitter", XRCCTRL(*
this,
"enfuse_splitter", wxSplitterWindow)->GetSashPosition());
198 config->Write(wxString::Format(
"/ToolboxFrame/FileListColumnWidth%d", j),
m_fileListCtrl->GetColumnWidth(j));
206 if (!wxPanel::Create(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL,
"panel"))
211 m_enfuseOptions =
new wxPropertyGrid(
this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxPG_SPLITTER_AUTO_CENTER);
219 wxXmlResource::Get()->LoadPanel(
this,
"enfuse_panel");
220 wxXmlResource::Get()->AttachUnknownControl(
"enfuse_properties",
m_enfuseOptions->GetGrid(),
this);
221 wxXmlResource::Get()->AttachUnknownControl(
"enfuse_preview_window",
m_preview,
this);
223 wxPanel* mainPanel = XRCCTRL(*
this,
"enfuse_panel", wxPanel);
224 wxBoxSizer* topsizer =
new wxBoxSizer(wxVERTICAL);
225 topsizer->Add(mainPanel, wxSizerFlags(1).Expand());
228 m_fileListCtrl->InsertColumn(0, _(
"Filename"), wxLIST_FORMAT_LEFT, 200);
229 m_fileListCtrl->InsertColumn(1, _(
"Aperture"), wxLIST_FORMAT_LEFT, 50);
230 m_fileListCtrl->InsertColumn(2, _(
"Shutter Speed"), wxLIST_FORMAT_LEFT, 50);
231 m_fileListCtrl->InsertColumn(3, _(
"ISO"), wxLIST_FORMAT_LEFT, 50);
236 wxConfigBase* config = wxConfigBase::Get();
238 if (config->HasEntry(
"/ToolboxFrame/Enfuse_Splitter"))
240 XRCCTRL(*
this,
"enfuse_splitter", wxSplitterWindow)->SetSashPosition(config->ReadLong(
"/ToolboxFrame/Enfuse_Splitter", 300));
242 const wxString enfuseOptionsString=config->Read(
"/ToolboxFrame/Enfuse_lastSettings");
243 if (!enfuseOptionsString.IsEmpty())
251 int width = config->Read(wxString::Format(
"/ToolboxFrame/FileListColumnWidth%d", j), -1);
284 wxFileName fullFilename(filename);
311 wxConfigBase* config = wxConfigBase::Get();
312 wxString path = config->Read(
"/actualPath",
"");
313 wxFileDialog dlg(
this, _(
"Add images"), path, wxEmptyString,
315 dlg.SetDirectory(path);
319 if (config->HasEntry(
"lastImageType"))
321 img_ext = config->Read(
"lastImageType").c_str();
323 if (img_ext ==
"all images")
324 dlg.SetFilterIndex(0);
325 else if (img_ext ==
"jpg")
326 dlg.SetFilterIndex(1);
327 else if (img_ext ==
"tiff")
328 dlg.SetFilterIndex(2);
329 else if (img_ext ==
"png")
330 dlg.SetFilterIndex(3);
331 else if (img_ext ==
"hdr")
332 dlg.SetFilterIndex(4);
333 else if (img_ext ==
"exr")
334 dlg.SetFilterIndex(5);
335 else if (img_ext ==
"all files")
336 dlg.SetFilterIndex(6);
339 if (dlg.ShowModal() == wxID_OK)
342 wxArrayString Pathnames;
343 dlg.GetPaths(Pathnames);
345 config->Write(
"/actualPath", dlg.GetDirectory());
347 switch (dlg.GetFilterIndex())
349 case 0: config->Write(
"lastImageType",
"all images");
break;
350 case 1: config->Write(
"lastImageType",
"jpg");
break;
351 case 2: config->Write(
"lastImageType",
"tiff");
break;
352 case 3: config->Write(
"lastImageType",
"png");
break;
353 case 4: config->Write(
"lastImageType",
"hdr");
break;
354 case 5: config->Write(
"lastImageType",
"exr");
break;
355 case 6: config->Write(
"lastImageType",
"all files");
break;
357 for (
auto& f : Pathnames)
371 if (
m_fileListCtrl->GetItemState(i, wxLIST_STATE_SELECTED) & wxLIST_STATE_SELECTED)
377 if (!selected.empty())
380 for (
auto i = selected.rbegin(); i != selected.rend(); ++i)
382 if (*i >= 0 && *i <
m_files.size())
402 long index =
m_fileListCtrl->GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
409 if (dlg.ShowModal() == wxID_OK)
415 for (
const auto& f : newFiles)
426 wxMessageBox(errorMsg, _(
"Hugin toolbox"), wxOK | wxICON_QUESTION);
440 if (e.GetKeyCode() == 1 && e.CmdDown())
445 m_fileListCtrl->SetItemState(i, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED);
465 "[Enfuse_Settings]\n"
466 "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"
467 "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"
470 wxFileConfig*
ReadIni(
const wxString& filename)
472 wxInputStream* iniStream{
nullptr };
473 if (wxFileExists(filename))
475 iniStream =
new wxFileInputStream(filename);
476 if (!iniStream->IsOk())
482 if (iniStream ==
nullptr)
484 iniStream =
new wxStringInputStream(
defaultIni);
487 wxFileConfig* iniFile=
new wxFileConfig(*iniStream);
495 wxFileConfig* iniFile =
ReadIni(iniFilename.GetFullPath());
497 iniFile->SetPath(
"Enfuse_Settings");
498 wxArrayString knownNames;
499 wxArrayString knownSettings;
502 bool hasKeys = iniFile->GetFirstEntry(key, indexKey);
505 knownNames.push_back(key);
506 knownSettings.push_back(iniFile->Read(key));
507 hasKeys = iniFile->GetNextEntry(key, indexKey);
509 int selection=wxGetSingleChoiceIndex(_(
"Select the Enfuse setting, which should be loaded."), _(
"Hugin toolbox"), knownNames, 0,
this);
520 wxFileConfig* iniFile =
ReadIni(iniFilename.GetFullPath());
522 iniFile->SetPath(
"Enfuse_Settings");
523 wxArrayString knownNames;
526 bool hasKeys = iniFile->GetFirstEntry(key, indexKey);
529 knownNames.push_back(key);
530 hasKeys = iniFile->GetNextEntry(key, indexKey);
535 name = wxGetTextFromUser(_(
"Enter name of Enfuse setting"),
"Enfuse settings", name,
this);
543 name.Replace(
"=",
"",
true);
544 if (knownNames.Index(name) != wxNOT_FOUND)
546 if (wxMessageBox(wxString::Format(_(
"Enfuse setting with name \"%s\" is already existing.\nShould it be overwritten?"), name.c_str()),
547 _(
"Hugin toolbox"), wxYES_NO | wxICON_QUESTION) == wxYES)
560 wxFileOutputStream iniStream(iniFilename.GetFullPath());
562 if (iniStream.IsOk())
564 success = iniFile->Save(iniStream);
568 wxMessageBox(wxString::Format(_(
"Could not save ini file \"%s\"."), iniFilename.GetFullPath()), _(
"Error"), wxOK | wxICON_ERROR,
this);
604 tempfile.SetExt(
"tif");
632 wxString exePath = wxFileName(wxStandardPaths::Get().GetExecutablePath()).GetPath(wxPATH_GET_VOLUME | wxPATH_GET_SEPARATOR);
645 exiftoolArgs.Append(
" -all:all --thumbnail --xposition --yposition --imagefullwidth --imagefullheight ");
659 wxConfigBase* config = wxConfigBase::Get();
660 wxString path = config->Read(
"/actualPath",
"");
661 wxFileDialog dlg(
this, _(
"Save output"), path, wxEmptyString,
GetMainImageFilters(), wxFD_SAVE | wxFD_OVERWRITE_PROMPT, wxDefaultPosition);
662 dlg.SetDirectory(path);
666 if (config->HasEntry(
"lastImageType"))
668 img_ext = config->Read(
"lastImageType").c_str();
670 if (img_ext ==
"jpg")
672 dlg.SetFilterIndex(0);
676 if (img_ext ==
"tiff")
678 dlg.SetFilterIndex(1);
682 if (img_ext ==
"png")
684 dlg.SetFilterIndex(2);
688 wxFileName outputfilename(
m_files[0]);
689 outputfilename.SetName(outputfilename.GetName() +
"_stacked");
690 dlg.SetFilename(outputfilename.GetFullPath());
692 if (dlg.ShowModal() == wxID_OK)
697 config->Write(
"/actualPath", dlg.GetDirectory());
699 switch (dlg.GetFilterIndex())
702 config->Write(
"lastImageType",
"jpg");
705 config->Write(
"lastImageType",
"tiff");
708 config->Write(
"lastImageType",
"png");
719 switch (e.GetSelection())
753 if (output.FileExists() && output.GetSize()>0)
771 wxPGProperty* prop =
m_enfuseOptions->Append(
new wxFloatProperty(
"Exposure weight",
"exposureWeight", 1));
772 prop->SetEditor(wxPGEditor_SpinCtrl);
773 prop->SetAttribute(wxPG_ATTR_MIN, 0);
774 prop->SetAttribute(wxPG_ATTR_MAX, 1);
775 prop->SetAttribute(wxPG_ATTR_SPINCTRL_STEP, 0.05);
776 prop =
m_enfuseOptions->Append(
new wxFloatProperty(
"Saturation weight",
"saturationWeight", 0));
777 prop->SetEditor(wxPGEditor_SpinCtrl);
778 prop->SetAttribute(wxPG_ATTR_MIN, 0);
779 prop->SetAttribute(wxPG_ATTR_MAX, 1);
780 prop->SetAttribute(wxPG_ATTR_SPINCTRL_STEP, 0.05);
781 prop =
m_enfuseOptions->Append(
new wxFloatProperty(
"Contrast weight",
"contrastWeight", 0));
782 prop->SetEditor(wxPGEditor_SpinCtrl);
783 prop->SetAttribute(wxPG_ATTR_MIN, 0);
784 prop->SetAttribute(wxPG_ATTR_MAX, 1);
785 prop =
m_enfuseOptions->Append(
new wxFloatProperty(
"Entropy weight",
"entropyWeight", 0));
786 prop->SetEditor(wxPGEditor_SpinCtrl);
787 prop->SetAttribute(wxPG_ATTR_MIN, 0);
788 prop->SetAttribute(wxPG_ATTR_MAX, 1);
789 prop->SetAttribute(wxPG_ATTR_SPINCTRL_STEP, 0.05);
791 m_enfuseOptions->Append(
new wxBoolProperty(
"Hard mask",
"hardMask",
false));
793 prop =
m_enfuseOptions->Append(
new wxPropertyCategory(_(
"General"),
"general"));
794 prop =
m_enfuseOptions->Append(
new wxIntProperty(
"Levels",
"levels", 0));
795 prop->SetEditor(wxPGEditor_SpinCtrl);
796 prop->SetAttribute(wxPG_ATTR_MIN, -29);
797 prop->SetAttribute(wxPG_ATTR_MAX, 29);
798 prop->SetAttribute(wxPG_ATTR_SPINCTRL_STEP, 1);
799 wxArrayString blendColorspaces;
800 blendColorspaces.Add(
"Auto");
801 blendColorspaces.Add(
"Identity (RGB)");
802 blendColorspaces.Add(
"CIELab");
803 blendColorspaces.Add(
"CIELuv");
804 blendColorspaces.Add(
"CIECAM02");
805 m_enfuseOptions->Append(
new wxEnumProperty(
"Blend colorspace",
"blendColorspace", blendColorspaces));
806 wxArrayString wrapMode;
807 wrapMode.Add(
"None");
808 wrapMode.Add(
"Horizontal");
809 wrapMode.Add(
"Vertical");
810 wrapMode.Add(
"Both");
811 m_enfuseOptions->Append(
new wxEnumProperty(
"Wrap mode",
"wrapMode", wrapMode));
813 m_enfuseOptions->Append(
new wxPropertyCategory(_(
"Fusions options"),
"fusionOptions"));
814 prop =
m_enfuseOptions->Append(
new wxFloatProperty(
"Exposure optimum",
"exposureOptimum", 0.5));
815 prop->SetEditor(wxPGEditor_SpinCtrl);
816 prop->SetAttribute(wxPG_ATTR_MIN, 0);
817 prop->SetAttribute(wxPG_ATTR_MAX, 1);
818 prop->SetAttribute(wxPG_ATTR_SPINCTRL_STEP, 0.05);
819 prop =
m_enfuseOptions->Append(
new wxFloatProperty(
"Exposure width",
"exposureWidth", 0.2));
820 prop->SetEditor(wxPGEditor_SpinCtrl);
821 prop->SetAttribute(wxPG_ATTR_MIN, 0);
822 prop->SetAttribute(wxPG_ATTR_MAX, 1);
823 prop->SetAttribute(wxPG_ATTR_SPINCTRL_STEP, 0.05);
824 prop =
m_enfuseOptions->Append(
new wxFloatProperty(
"Contrast edge scale",
"contrastEdgeScale", 0));
825 prop->SetEditor(wxPGEditor_SpinCtrl);
826 prop->SetAttribute(wxPG_ATTR_MIN, 0);
827 prop->SetAttribute(wxPG_ATTR_MAX, 5);
828 prop->SetAttribute(wxPG_ATTR_SPINCTRL_STEP, 0.1);
829 prop =
m_enfuseOptions->Append(
new wxFloatProperty(
"Contrast min curvature",
"contrastMinCurvature", 0));
830 prop->SetEditor(wxPGEditor_SpinCtrl);
831 prop->SetAttribute(wxPG_ATTR_MIN, 0);
832 prop->SetAttribute(wxPG_ATTR_MAX, 50);
833 prop->SetAttribute(wxPG_ATTR_SPINCTRL_STEP, 0.5);
834 prop =
m_enfuseOptions->Append(
new wxIntProperty(
"Contrast window size",
"contrastWindowSize", 5));
835 prop->SetEditor(wxPGEditor_SpinCtrl);
836 prop->SetAttribute(wxPG_ATTR_MIN, 3);
837 prop->SetAttribute(wxPG_ATTR_MAX, 30);
838 prop->SetAttribute(wxPG_ATTR_SPINCTRL_STEP, 1);
839 prop =
m_enfuseOptions->Append(
new wxFloatProperty(
"Entropy lower cutoff",
"entropyLowerCutoff", 0));
840 prop->SetEditor(wxPGEditor_SpinCtrl);
841 prop->SetAttribute(wxPG_ATTR_MIN, 0);
842 prop->SetAttribute(wxPG_ATTR_MAX, 100);
843 prop->SetAttribute(wxPG_ATTR_SPINCTRL_STEP, 0.5);
844 prop =
m_enfuseOptions->Append(
new wxFloatProperty(
"Entropy higher cutoff",
"entropyUpperCutoff", 100));
845 prop->SetEditor(wxPGEditor_SpinCtrl);
846 prop->SetAttribute(wxPG_ATTR_MIN, 0);
847 prop->SetAttribute(wxPG_ATTR_MAX, 100);
848 prop->SetAttribute(wxPG_ATTR_SPINCTRL_STEP, 0.5);
849 prop =
m_enfuseOptions->Append(
new wxIntProperty(
"Entropy window size",
"entropyWindowSize", 3));
850 prop->SetEditor(wxPGEditor_SpinCtrl);
851 prop->SetAttribute(wxPG_ATTR_MIN, 3);
852 prop->SetAttribute(wxPG_ATTR_MAX, 7);
853 prop->SetAttribute(wxPG_ATTR_SPINCTRL_STEP, 1);
854 prop =
m_enfuseOptions->Append(
new wxFloatProperty(
"Expoure lower cutoff",
"exposureLowerCutoff", 0));
855 prop->SetEditor(wxPGEditor_SpinCtrl);
856 prop->SetAttribute(wxPG_ATTR_MIN, 0);
857 prop->SetAttribute(wxPG_ATTR_MAX, 100);
858 prop->SetAttribute(wxPG_ATTR_SPINCTRL_STEP, 0.5);
859 prop =
m_enfuseOptions->Append(
new wxFloatProperty(
"Exposure higher cutoff",
"exposureUpperCutoff", 100));
860 prop->SetEditor(wxPGEditor_SpinCtrl);
861 prop->SetAttribute(wxPG_ATTR_MIN, 0);
862 prop->SetAttribute(wxPG_ATTR_MAX, 100);
863 prop->SetAttribute(wxPG_ATTR_SPINCTRL_STEP, 0.5);
864 wxArrayString exposureWeightFunction;
865 exposureWeightFunction.Add(
"Gaussian");
866 exposureWeightFunction.Add(
"Lorentzian");
867 exposureWeightFunction.Add(
"Half-sine");
868 exposureWeightFunction.Add(
"Full-sine");
869 exposureWeightFunction.Add(
"Bi-square");
870 m_enfuseOptions->Append(
new wxEnumProperty(
"Exposure weight function",
"exposureWeightFunction", exposureWeightFunction));
871 wxArrayString grayProjector;
872 grayProjector.Add(
"anti-value");
873 grayProjector.Add(
"Average");
874 grayProjector.Add(
"L-channel from Lab (gamma=1)");
875 grayProjector.Add(
"L-channel from Lab (gamma corrected)");
876 grayProjector.Add(
"Lightness");
877 grayProjector.Add(
"Luminance");
878 grayProjector.Add(
"Value from HSV");
880 prop =
m_enfuseOptions->Append(
new wxEnumProperty(
"Gray projector",
"grayProjector", grayProjector));
887 wxString commandline(
"--verbose ");
888 double doubleValue=
m_enfuseOptions->GetPropertyValueAsDouble(
"exposureWeight");
889 if (doubleValue != 1)
891 commandline.Append(
" --exposure-weight=" + wxString::FromCDouble(doubleValue));
893 doubleValue =
m_enfuseOptions->GetPropertyValueAsDouble(
"saturationWeight");
894 if (doubleValue != 0)
896 commandline.Append(
" --saturation-weight=" + wxString::FromCDouble(doubleValue));
898 doubleValue =
m_enfuseOptions->GetPropertyValueAsDouble(
"contrastWeight");
899 if (doubleValue != 0)
901 commandline.Append(
" --contrast-weight=" + wxString::FromCDouble(doubleValue));
903 doubleValue =
m_enfuseOptions->GetPropertyValueAsDouble(
"entropyWeight");
904 if (doubleValue != 0)
906 commandline.Append(
" --entropy-weight=" + wxString::FromCDouble(doubleValue));
911 commandline.Append(
" --hard-mask");
916 commandline.Append(wxString::Format(
" --level=%d", intValue));
922 commandline.Append(
" --blend-colorspace=identity");
925 commandline.Append(
" --blend-colorspace=cielab");
928 commandline.Append(
" --blend-colorspace=cieluv");
931 commandline.Append(
" --blend-colorspace=ciecam");
942 commandline.Append(
" --wrap=horizontal");
945 commandline.Append(
" --wrap=vertical");
948 commandline.Append(
" --wrap=both ");
954 doubleValue =
m_enfuseOptions->GetPropertyValueAsDouble(
"exposureOptimum");
955 if (doubleValue != 0.5)
957 commandline.Append(
" --exposure-optimum=" + wxString::FromCDouble(doubleValue));
959 doubleValue =
m_enfuseOptions->GetPropertyValueAsDouble(
"exposureWidth");
960 if (doubleValue != 0.2)
962 commandline.Append(
" --exposure-width=" + wxString::FromCDouble(doubleValue));
964 doubleValue =
m_enfuseOptions->GetPropertyValueAsDouble(
"contrastEdgeScale");
965 if (doubleValue != 0)
967 commandline.Append(
" --contrast-edge-scale=" + wxString::FromCDouble(doubleValue));
969 doubleValue =
m_enfuseOptions->GetPropertyValueAsDouble(
"contrastMinCurvature");
970 if (doubleValue != 0)
972 commandline.Append(
" --contrast-min-curvature=" + wxString::FromCDouble(doubleValue) +
"%");
974 intValue =
m_enfuseOptions->GetPropertyValueAsInt(
"contrastWindowSize");
977 commandline.Append(wxString::Format(
" --contrast-window-size=%d", intValue));
980 doubleValue =
m_enfuseOptions->GetPropertyValueAsDouble(
"entropyLowerCutoff");
981 double doubleValue2 =
m_enfuseOptions->GetPropertyValueAsDouble(
"entropyUpperCutoff");
982 if (doubleValue > 0 || doubleValue2 < 100)
984 commandline.Append(
" --entropy-cutoff=" + wxString::FromCDouble(doubleValue) +
"%");
985 if (doubleValue2 < 100)
987 commandline.Append(
":" + wxString::FromCDouble(doubleValue2) +
"%");
990 intValue =
m_enfuseOptions->GetPropertyValueAsInt(
"entropyWindowSize");
993 commandline.Append(wxString::Format(
" --entropy-window-size=%d", intValue));
996 doubleValue =
m_enfuseOptions->GetPropertyValueAsDouble(
"exposureLowerCutoff");
997 doubleValue2 =
m_enfuseOptions->GetPropertyValueAsDouble(
"exposureUpperCutoff");
998 if (doubleValue > 0 || doubleValue2 < 100)
1000 commandline.Append(
" --exposure-cutoff=" + wxString::FromCDouble(doubleValue) +
"%");
1001 if (doubleValue2 < 100)
1003 commandline.Append(
":" + wxString::FromCDouble(doubleValue2) +
"%");
1007 intValue =
m_enfuseOptions->GetPropertyValueAsInt(
"exposureWeightFunction");
1011 commandline.Append(
" --exposure-weight-function=lorentz");
1014 commandline.Append(
" --exposure-weight-function=halfsine");
1017 commandline.Append(
" --exposure-weight-function=fullsine");
1020 commandline.Append(
" --exposure-weight-function=bisquare");
1031 commandline.Append(
" --gray-projector=anti-value");
1034 commandline.Append(
" --gray-projector=al-star");
1037 commandline.Append(
" --gray-projector=pl-star");
1040 commandline.Append(
" --gray-projector=lightness");
1043 commandline.Append(
" --gray-projector=luminance");
1046 commandline.Append(
" --gray-projector=value");
1059 commandline.Append(
" ");
1062 wxArrayInt selectedFiles;
1067 selectedFiles.push_back(i);
1070 if (selectedFiles.IsEmpty())
1072 wxMessageBox(_(
"Please activate at least one file."),
1078 wxOK | wxOK_DEFAULT | wxICON_WARNING);
1079 return wxEmptyString;
1081 for (
int i = 0; i < selectedFiles.size(); ++i)
1083 commandline.Append(
" ");
1092 XRCCTRL(*
this,
"enfuse_remove_file", wxButton)->Enable(
m_fileListCtrl->GetSelectedItemCount() >= 1);
1093 XRCCTRL(*
this,
"enfuse_create_file", wxButton)->Enable(
m_fileListCtrl->GetSelectedItemCount() == 1);
1112 XRCCTRL(*
this,
"enfuse_preview", wxButton)->Enable(enable);
1113 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.
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