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>
60 if (file.GetExt().CmpNoCase(
"jpg") == 0 ||
61 file.GetExt().CmpNoCase(
"jpeg") == 0 ||
62 file.GetExt().CmpNoCase(
"tif") == 0 ||
63 file.GetExt().CmpNoCase(
"tiff") == 0 ||
64 file.GetExt().CmpNoCase(
"png") == 0 ||
65 file.GetExt().CmpNoCase(
"bmp") == 0 ||
66 file.GetExt().CmpNoCase(
"gif") == 0 ||
67 file.GetExt().CmpNoCase(
"pnm") == 0 ||
68 file.GetExt().CmpNoCase(
"sun") == 0 ||
69 file.GetExt().CmpNoCase(
"hdr") == 0 ||
70 file.GetExt().CmpNoCase(
"viff") == 0)
72 files.push_back(file.GetFullPath());
98 if (
prop[1] ==
"double")
108 if (
prop[1] ==
"long")
118 if (
prop[1] ==
"bool")
120 if (
prop[2] ==
"true")
122 grid->SetPropertyValue(
prop[0],
true);
126 grid->SetPropertyValue(
prop[0],
false);
144 for (
it = grid->GetIterator(); !
it.AtEnd();
it++)
156 const wxString type = p->GetValueType();
157 output.Append(p->GetName() +
":");
158 if (type ==
"double")
160 output.Append(
"double:" + wxString::FromCDouble(p->GetValue().GetDouble()));
166 output.Append(
"long:" + wxString::FromCDouble(p->GetValue().GetLong()));
172 if (p->GetValue().GetBool())
174 output.Append(
"bool:true");
178 output.Append(
"bool:false");
201 config->Write(wxString::Format(
"/ToolboxFrame/Enfuse/FileListColumnWidth%d",
j),
m_fileListCtrl->GetColumnWidth(
j));
223 wxXmlResource::Get()->LoadPanel(
this,
"enfuse_panel");
224 wxXmlResource::Get()->AttachUnknownControl(
"enfuse_properties",
m_enfuseOptions->GetGrid(),
this);
225 wxXmlResource::Get()->AttachUnknownControl(
"enfuse_preview_window",
m_preview,
this);
244 if (
config->HasEntry(
"/ToolboxFrame/Enfuse/Splitter"))
257 int width =
config->Read(wxString::Format(
"/ToolboxFrame/Enfuse/FileListColumnWidth%d",
j), -1);
298 if (srcImage.readEXIF())
314 dlg.SetDirectory(path);
318 if (
config->HasEntry(
"lastImageType"))
323 dlg.SetFilterIndex(0);
325 dlg.SetFilterIndex(1);
327 dlg.SetFilterIndex(2);
329 dlg.SetFilterIndex(3);
331 dlg.SetFilterIndex(4);
333 dlg.SetFilterIndex(5);
334 else if (
img_ext ==
"all files")
335 dlg.SetFilterIndex(6);
344 config->Write(
"/actualPath",
dlg.GetDirectory());
346 switch (
dlg.GetFilterIndex())
348 case 0:
config->Write(
"lastImageType",
"all images");
break;
349 case 1:
config->Write(
"lastImageType",
"jpg");
break;
350 case 2:
config->Write(
"lastImageType",
"tiff");
break;
351 case 3:
config->Write(
"lastImageType",
"png");
break;
352 case 4:
config->Write(
"lastImageType",
"hdr");
break;
353 case 5:
config->Write(
"lastImageType",
"exr");
break;
354 case 6:
config->Write(
"lastImageType",
"all files");
break;
438 if (e.GetKeyCode() == 1 && e.CmdDown())
450 e.SetId(
XRCID(
"enfuse_add_file"));
459 e.SetId(
XRCID(
"enfuse_remove_file"));
477 if (index >= 0 && index <
m_files.size())
485 wxGetApp().GetToolboxFrame()->HasMonitorProfile(),
wxGetApp().GetToolboxFrame()->GetMonitorProfile());
511 wxGetApp().GetToolboxFrame()->HasMonitorProfile(),
wxGetApp().GetToolboxFrame()->GetMonitorProfile());
523 "[Enfuse_Settings]\n"
524 "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"
525 "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"
555 iniFile->SetPath(
"Enfuse_Settings");
580 iniFile->SetPath(
"Enfuse_Settings");
593 name =
wxGetTextFromUser(
_(
"Enter name of Enfuse setting"),
"Enfuse settings", name,
this);
601 name.Replace(
"=",
"",
true);
604 if (
hugin_utils::HuginMessageBox(wxString::Format(
_(
"Enfuse setting with name \"%s\" is already existing.\nShould it be overwritten?"), name),
703 exiftoolArgs.Append(
" -all:all --thumbnail --thumbnailimage --xposition --yposition --imagefullwidth --imagefullheight ");
720 dlg.SetDirectory(path);
724 if (
config->HasEntry(
"lastImageType"))
730 dlg.SetFilterIndex(0);
736 dlg.SetFilterIndex(1);
742 dlg.SetFilterIndex(2);
755 config->Write(
"/actualPath",
dlg.GetDirectory());
757 switch (
dlg.GetFilterIndex())
760 config->Write(
"lastImageType",
"jpg");
763 config->Write(
"lastImageType",
"tiff");
766 config->Write(
"lastImageType",
"png");
777 switch (e.GetSelection())
981 commandline.Append(
" --blend-colorspace=identity");
1070 commandline.Append(
" --exposure-weight-function=lorentz");
1073 commandline.Append(
" --exposure-weight-function=halfsine");
1076 commandline.Append(
" --exposure-weight-function=fullsine");
1079 commandline.Append(
" --exposure-weight-function=bisquare");
1090 commandline.Append(
" --gray-projector=anti-value");
1099 commandline.Append(
" --gray-projector=lightness");
1102 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)
HuginBase::ImageCache::RequestPtr m_imgRequest
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 OnImageLoaded(HuginBase::ImageCache::EntryPtr entry, std::string filename)
called when is image is fully loaded to display image in wxStaticBitmap
void CleanUpTempFiles()
delete all temporary files, to be called mainly at end
std::string m_selectedImage
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,...
wxStaticBitmap * m_previewSelectedImage
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)
wxNotebook * m_enfuse_preview_notebook
void EnableFileButtons()
enable/disable the file(s) remove and create buttons depending on selection of wxListCtrl
void OnResetSetting(wxCommandEvent &e)
void OnFileSelectionChanged(wxCommandEvent &e)
static ImageCache & getInstance()
get the global ImageCache object
RequestPtr requestAsyncSmallImage(const std::string &filename)
Request a small image be loaded.
std::shared_ptr< Entry > EntryPtr
a shared pointer to the entry
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.
void GeneratePreviewSelectedFile(wxStaticBitmap *control, ImageCache::EntryPtr cacheEntry, const bool hasMonitorProfile, const cmsHPROFILE &monitorProfile)
load given image from image cache and display in wxStaticBitmap control