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>
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());
96 if (
prop[1] ==
"double")
106 if (
prop[1] ==
"long")
116 if (
prop[1] ==
"bool")
118 if (
prop[2] ==
"true")
120 grid->SetPropertyValue(
prop[0],
true);
124 grid->SetPropertyValue(
prop[0],
false);
142 for (
it = grid->GetIterator(); !
it.AtEnd();
it++)
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");
199 config->Write(wxString::Format(
"/ToolboxFrame/Enfuse/FileListColumnWidth%d",
j),
m_fileListCtrl->GetColumnWidth(
j));
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);
239 if (
config->HasEntry(
"/ToolboxFrame/Enfuse/Splitter"))
252 int width =
config->Read(wxString::Format(
"/ToolboxFrame/Enfuse/FileListColumnWidth%d",
j), -1);
292 if (srcImage.readEXIF())
308 dlg.SetDirectory(path);
312 if (
config->HasEntry(
"lastImageType"))
317 dlg.SetFilterIndex(0);
319 dlg.SetFilterIndex(1);
321 dlg.SetFilterIndex(2);
323 dlg.SetFilterIndex(3);
325 dlg.SetFilterIndex(4);
327 dlg.SetFilterIndex(5);
328 else if (
img_ext ==
"all files")
329 dlg.SetFilterIndex(6);
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;
432 if (e.GetKeyCode() == 1 && e.CmdDown())
444 e.SetId(
XRCID(
"enfuse_add_file"));
453 e.SetId(
XRCID(
"enfuse_remove_file"));
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"
510 iniFile->SetPath(
"Enfuse_Settings");
535 iniFile->SetPath(
"Enfuse_Settings");
548 name =
wxGetTextFromUser(
_(
"Enter name of Enfuse setting"),
"Enfuse settings", name,
this);
556 name.Replace(
"=",
"",
true);
559 if (
hugin_utils::HuginMessageBox(wxString::Format(
_(
"Enfuse setting with name \"%s\" is already existing.\nShould it be overwritten?"), name),
658 exiftoolArgs.Append(
" -all:all --thumbnail --thumbnailimage --xposition --yposition --imagefullwidth --imagefullheight ");
675 dlg.SetDirectory(path);
679 if (
config->HasEntry(
"lastImageType"))
685 dlg.SetFilterIndex(0);
691 dlg.SetFilterIndex(1);
697 dlg.SetFilterIndex(2);
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())
936 commandline.Append(
" --blend-colorspace=identity");
1025 commandline.Append(
" --exposure-weight-function=lorentz");
1028 commandline.Append(
" --exposure-weight-function=halfsine");
1031 commandline.Append(
" --exposure-weight-function=fullsine");
1034 commandline.Append(
" --exposure-weight-function=bisquare");
1045 commandline.Append(
" --gray-projector=anti-value");
1054 commandline.Append(
" --gray-projector=lightness");
1057 commandline.Append(
" --gray-projector=luminance");
Definition of dialog class to create brighter/darker versions of the image.
wxString GetPropertyGridContent(const wxPropertyGrid *grid)
wxFileConfig * ReadIni(const wxString &filename)
static const wxString defaultIni
default ini, if no one exists load this one
void SetPropertyGridContent(wxPropertyGrid *grid, const wxString values)
declaration of panel for enfuse GUI
basic classes and function for queuing commands in wxWidgets
Dialog for create brighter and/or darker versions of an image.
file drag and drop handler method
EnfusePanel * m_enfusePanel
EnfuseDropTarget(EnfusePanel *parent)
bool OnDropFiles(wxCoord x, wxCoord y, const wxArrayString &filenames)
void PopulateEnfuseOptions()
fill the PropertyGrid with all enfuse options
PreviewWindow * m_preview
bool Create(wxWindow *parent, MyExecPanel *logPanel)
creates the control and populates all controls with their settings
void OnZoom(wxCommandEvent &e)
wxPropertyGrid * m_enfuseOptions
void OnCreateFile(wxCommandEvent &e)
void AddFile(const wxString &filename)
adds the given file to the list
void OnAddFiles(wxCommandEvent &e)
event handler
void OnProcessFinished(wxCommandEvent &e)
call at the end of the enfuse command, to load result back and enable buttons again
void OnFileListChar(wxKeyEvent &e)
void OnRemoveFile(wxCommandEvent &e)
void OnGenerateOutput(wxCommandEvent &e)
void CleanUpTempFiles()
delete all temporary files, to be called mainly at end
void EnableOutputButtons(bool enable)
enable/disable output buttons
void ExecuteEnfuseExiftool()
build the command line and execute enfuse and exiftool afterwards
long GetCheckedItemCount() const
return the number of check images
void OnGeneratePreview(wxCommandEvent &e)
~EnfusePanel()
destructor, save state and settings
wxString GetEnfuseOptions()
build string with all enfuse options from values in wxPropertyGrid this are the mainly the fusion opt...
MyExecPanel * m_logWindow
void OnFileCheckStateChanged(wxCommandEvent &e)
wxString GetEnfuseCommandLine()
get the full commandline for enfuse without program, but with files and output options,...
wxArrayString m_tempFiles
wxArrayString m_outputFilenames
void OnLoadSetting(wxCommandEvent &e)
wxListCtrl * m_fileListCtrl
void ExecuteEnfuse()
build the command line and execute enfuse command
void OnSaveSetting(wxCommandEvent &e)
void EnableFileButtons()
enable/disable the file(s) remove and create buttons depending on selection of wxListCtrl
void OnResetSetting(wxCommandEvent &e)
void OnFileSelectionChanged(wxCommandEvent &e)
All variables of a source image.
normal command for queue, processing is stopped if an error occurred in program
optional command for queue, processing of queue is always continued, also if an error occurred
int ExecQueue(HuginQueue::CommandQueue *queue)
void AddString(const wxString &s)
display the string in the panel
int ExecWithRedirect(wxString command)
void ClearOutput()
clear the output
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
void setImage(const wxString &filename)
set the current image and mask list, this loads also the image from cache
void setScale(double factor)
set the scaling factor f.
std::set< unsigned int > UIntSet
str wxEscapeFilename(const str &arg)
special escaping routine for CommandQueues
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
const wxString GetConfigTempDir(const wxConfigBase *config)
return the temp dir from the preferences, ensure that it ends with path separator
str wxQuoteFilename(const str &arg)
Quote a filename, so that it is surrounded by "".
int HuginMessageBox(const wxString &message, const wxString &caption, int style, wxWindow *parent)
std::string GetUserAppDataDir()
returns the directory for user specific Hugin settings, e.g.
std::vector< deghosting::BImagePtr > threshold(const std::vector< deghosting::FImagePtr > &inputImages, const double threshold, const uint16_t flags)
Threshold function used for creating alpha masks for images.