28#include <wx/translation.h>
31#include <wx/txtstrm.h>
32#include <wx/wfstream.h>
50 for (HuginBase::UIntSet::const_iterator
it = img.begin();
it != img.end(); ++
it)
60 for (
size_t i = 0;
i <
input.size(); ++
i)
130 outputFile <<
"-CompositeImage=General Composite Image" << endl;
140 int left =
roi.left();
142 int width =
roi.width();
143 int height =
roi.height();
160 top = height/2 - top;
162 outputFile <<
"-UsePanoramaViewer=True" << endl;
163 outputFile <<
"-StitchingSoftware=Hugin" << endl;
166 outputFile <<
"-ProjectionType=cylindrical" << endl;
170 outputFile <<
"-ProjectionType=equirectangular" << endl;
172 outputFile <<
"-CroppedAreaLeftPixels=" << left << endl;
173 outputFile <<
"-CroppedAreaTopPixels=" << top << endl;
174 outputFile <<
"-CroppedAreaImageWidthPixels=" << width << endl;
175 outputFile <<
"-CroppedAreaImageHeightPixels=" << height << endl;
213 <<
"============================================" <<
wxEndl
214 <<
_(
"Stitching panorama...") <<
wxEndl
215 <<
"============================================" <<
wxEndl
219 <<
_(
"Working directory:") <<
" " << wxFileName::GetCwd() <<
wxEndl
220 <<
_(
"Output prefix:") <<
" " << prefix <<
wxEndl
236 output <<
_(
"Blender:") <<
" " <<
_(
"Unknown blender (enblend --version failed)") <<
wxEndl;
255 output <<
_(
"Exposure fusion:") <<
" " <<
_(
"Unknown exposure fusion (enfuse --version failed)") <<
wxEndl;
276 << wxString::Format(
_(
"Canvas size: %dx%d"), opts.
getSize().width(), opts.
getSize().height()) <<
wxEndl
277 << wxString::Format(
_(
"ROI: (%d, %d) - (%d, %d)"), opts.
getROI().left(), opts.
getROI().top(), opts.
getROI().right(), opts.
getROI().bottom()) <<
" " <<
wxEndl
300 output <<
"* " <<
_(
"Exposure corrected, low dynamic range") <<
wxEndl;
308 output <<
"* " <<
_(
"Exposure fused from any arrangement") <<
wxEndl;
321 output <<
"* " <<
_(
"Exposure corrected, low dynamic range") <<
wxEndl;
325 output <<
"* " <<
_(
"No exposure correction, low dynamic range") <<
wxEndl;
349 <<
"* " <<
_(
"Blended layers of similar exposure, without exposure correction") <<
wxEndl
355 <<
_(
"Filename:") <<
" " << img.getFilename() <<
wxEndl
359 << wxString::Format(
_(
"HFOV: %.0f"), img.getHFOV()) <<
wxEndl
360 << wxString::Format(
_(
"Exposure value: %.1f"), img.getExposureValue()) <<
wxEndl
377 for (
size_t i = 0;
i < stacks.size(); ++
i)
409 _(
"Filling edges...")));
421 errStream <<
"ERROR: No active images in ROI. Nothing to do." << std::endl;
424 std::vector<HuginBase::UIntSet> stacks;
432 errStream <<
"ERROR: Only nona remappper is supported by hugin_executor." << std::endl;
437 errStream <<
"ERROR: Only enblend and internal remappper are currently supported by hugin_executor." << std::endl;
442 errStream <<
"ERROR: Only hdr merger HDRMERGE_AVERAGE is currently supported by hugin_executor." << std::endl;
478 if (
roi.top() != 0 ||
roi.left() != 0)
519 if (
roi.top() != 0 ||
roi.left() != 0)
619 errStream <<
"ERROR: Invalid output image type found." << std::endl;
647 _(
"Remapping LDR images...")));
667 _(
"Blending images..."))
719 finalNonaArgs.append(
" --save-intermediate-images --intermediate-suffix=layers_");
729 finalNonaArgs,
_(
"Remapping LDR images and blending exposure layers...")));
747 _(
"Remapping LDR images without exposure correction...")));
767 wxString::Format(
_(
"Blending exposure layer %u..."),
exposureLayer))
797 _(
"Fusing all exposure layers..."))
833 wxString::Format(
_(
"Fusing stack number %u..."),
stackNr))
868 _(
"Blending all stacks..."))
916 _(
"Remapping HDR images...")));
938 wxString::Format(
_(
"Merging HDR stack number %u..."),
stackNr)));
964 _(
"Blending HDR stacks..."))
971 _(
"Blending HDR stacks...")));
1005 _(
"Updating metadata...")));
1011 _(
"Updating metadata...")));
1028 errStream <<
"ERROR: Step " <<
stepNr <<
" has no program name specified." << std::endl;
1035 if (prog.CmpNoCase(
"verdandi") == 0)
1041 if (prog.CmpNoCase(
"hugin_hdrmerge") == 0)
1093 int pos = args.Find(
"%" + name);
1099 args.Replace(
"%" + name +
"%", wxString::Format(
"%d", value),
true);
1123 pos = args.Find(
"%" + name);
1136 errStream <<
"ERROR: No active images in ROI. Nothing to do." << std::endl;
1147 settings.Read(
"/General/StepCount", &
stepCount, 0);
1150 errStream <<
"ERROR: User-setting does not define any output steps." << std::endl;
1160 statusText = wxString::Format(
_(
"Stitching using \"%s\""), desc.c_str());
1173 if (
roi.top() != 0 ||
roi.left() != 0)
1191 std::vector<HuginBase::UIntSet> stacks;
1201 errStream <<
"ERROR: Output specifies " <<
stepCount <<
" steps, but step " <<
i <<
" is missing in configuration." << std::endl;
1216 errStream <<
"ERROR: Step " <<
i <<
" has no arguments given." << std::endl;
1221 if (
stepType.CmpNoCase(
"remap") == 0)
1224 const bool outputLayers = (settings.Read(
"OutputExposureLayers", 0l) == 1l);
1227 args.Append(
" --create-exposure-layers -o " +
wxEscapeFilename(prefix +
"_layer"));
1246 if (settings.Read(
"Keep", 0l) == 0l)
1260 if (settings.Read(
"Keep", 0l) == 0l)
1272 if (
stepType.CmpNoCase(
"merge") == 0)
1278 errStream <<
"ERROR: Step " <<
i <<
" has no result file specified." << std::endl;
1282 resultFile.Replace(
"%prefix%", prefix,
true);
1285 errStream <<
"ERROR: Step " <<
i <<
" has missing %result% placeholder in arguments." << std::endl;
1295 errStream <<
"ERROR: Step " <<
i <<
" has missing %input% placeholder in arguments." << std::endl;
1313 errStream <<
"ERROR: Step " <<
i <<
" has missing %input% placeholder in arguments." << std::endl;
1331 errStream <<
"ERROR: Step " <<
i <<
" has missing %input% placeholder in arguments." << std::endl;
1356 if (settings.Read(
"Keep", 1l) == 0l)
1363 if (
stepType.CmpNoCase(
"stack") == 0)
1373 const bool clean = (settings.Read(
"Keep", 0l) == 0l);
1382 errStream <<
"ERROR: Step " <<
i <<
" has missing %input% placeholder in arguments." << std::endl;
1388 errStream <<
"ERROR: Step " <<
i <<
" has missing %output% placeholder in arguments." << std::endl;
1406 if (
stepType.CmpNoCase(
"layer") == 0)
1416 const bool clean = (settings.Read(
"Keep", 0l) == 0l);
1425 errStream <<
"ERROR: Step " <<
i <<
" has missing %input% placeholder in arguments." << std::endl;
1431 errStream <<
"ERROR: Step " <<
i <<
" has missing %output% placeholder in arguments." << std::endl;
1449 if (
stepType.CmpNoCase(
"modify") == 0)
1453 if (inputFiles.IsEmpty())
1455 errStream <<
"ERROR: Step " <<
i <<
" has no input/output file specified." << std::endl;
1461 errStream <<
"ERROR: Step " <<
i <<
" has missing %file% placeholder in arguments." << std::endl;
1468 errStream <<
"ERROR: Step " <<
i <<
" has invalid %prefix% placeholder in arguments." << std::endl;
1474 errStream <<
"ERROR: Step " <<
i <<
" has invalid %width% placeholder in arguments." << std::endl;
1480 errStream <<
"ERROR: Step " <<
i <<
" has invalid %height% placeholder in arguments." << std::endl;
1487 errStream <<
"ERROR: Step " <<
i <<
" has no program name specified." << std::endl;
1494#elif defined __WXMSW__
1500 if (inputFiles.CmpNoCase(
"all") == 0)
1512 if (inputFiles.CmpNoCase(
"stacks") == 0)
1516 errStream <<
"ERROR: Step " <<
i <<
" requests to modify stacks, but no stack was created before." << std::endl;
1529 if (inputFiles.CmpNoCase(
"layers") == 0)
1533 errStream <<
"ERROR: Step " <<
i <<
" requests to modify exposure layers, but no exposure layer was created before." << std::endl;
1546 inputFiles.Replace(
"%prefix%", prefix,
true);
1555 if (
stepType.CmpNoCase(
"exiftool") == 0)
1560 errStream <<
"ERROR: Step " <<
i <<
" has no result file specified." << std::endl;
1564 resultFile.Replace(
"%prefix%", prefix,
true);
1567 errStream <<
"ERROR: Step " <<
i <<
" has missing %result% placeholder in arguments." << std::endl;
1594 for (
size_t i = 0;
i < files.size(); ++
i)
declaration of functions to handle stacks and layers
interface of CommandQueue creating for stitching engine
bool outputHDRLayers
save remapped layers (HDR)
bool outputLDRExposureLayers
save blended exposure layers, do not perform fusion (no exposure adjustment)
EdgeFillMode
edge fill modes
BlendingMechanism blendMode
bool outputLDRExposureBlended
< save exposure fused stacks (no exposure adjustment)
std::string hdrmergeOptions
std::string verdandiOptions
bool outputLDRExposureRemapped
save remapped layers (no exposure adjustment)
const vigra::Rect2D & getROI() const
EdgeFillMode edgeFillMode
bool outputLDRBlended
save blended panorama (LDR)
bool outputLDRLayers
save remapped layers (LDR)
unsigned int getWidth() const
PanoramaOptions::ProjectionFormat getProjection() const
double outputExposureValue
bool outputHDRStacks
save image stacks (HDR)
std::string enblendOptions
std::string tiffCompression
bool outputLDRExposureLayersFused
save blended exposure layers which are then fused (no exposure adjustment)
std::string outputImageType
std::string outputLayersCompression
HDRMergeType hdrMergeMode
std::string enfuseOptions
std::string outputImageTypeHDR
std::string outputImageTypeCompression
unsigned int getHeight() const
get panorama height
unsigned int colorReferenceImage
vigra::Size2D getSize() const
get size of output image
bool outputHDRBlended
save blended panorama (HDR)
const SrcPanoImage & getImage(std::size_t nr) const
get a panorama image, counting starts with 0
const PanoramaOptions & getOptions() const
returns the options for this panorama
PanoramaData * getNewSubset(const UIntSet &imgs) const
UIntSet getActiveImages() const
get active images
std::size_t getNrOfImages() const
number of images.
All variables of a source image.
int getWidth() const
Get the width of the image in pixels.
int getHeight() const
Get the height of the image in pixels.
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
#define HUGIN_USE_EXIFTOOL
#define HUGIN_EXIFTOOL_CREATE_GPANO
#define HUGIN_NONA_USEGPU
std::vector< unsigned int > UIntVector
UIntVector getEstimatedBlendingOrder(const PanoramaData &pano, const UIntSet &images, const unsigned int referenceImage)
returns vector of image numbers for blending in approbiate order
std::vector< UIntSet > UIntSetVector
std::set< unsigned int > UIntSet
std::vector< UIntSet > getHDRStacks(const PanoramaData &pano, UIntSet allImgs, PanoramaOptions opts)
returns vector of set of output stacks
std::vector< UIntSet > getExposureLayers(const PanoramaData &pano, UIntSet allImgs, PanoramaOptions opts)
returns vector of set of output exposure layers
wxString PrintDetailInfo(const HuginBase::Panorama &pano, const HuginBase::PanoramaOptions &opts, const HuginBase::UIntSet &allActiveImages, const wxString &prefix, const wxString &bindir, wxConfigBase *config, double &exiftoolVersion)
bool ReplacePrefixPlaceholder(wxString &args, const wxString prefix)
wxString GenerateFinalArgfile(const HuginBase::Panorama &pano, const wxString &projectName, const wxConfigBase *config, const HuginBase::UIntSet &images, const double exifToolVersion)
generate the final argfile
void AddEdgeFillCommand(HuginQueue::CommandQueue *commands, const HuginBase::PanoramaOptions::EdgeFillMode &edgeFillMode, const wxString &ExePath, const wxString &inputFilename, const wxString &outputFilename, const wxString &compression)
adds the command for the edge fill option
wxArrayString GetNumberedFilename(const wxString &prefix, const wxString &postfix, const HuginBase::UIntSet &img)
returns an array of filenames with numbers
bool AddBlenderCommand(CommandQueue *queue, const wxString &ExePath, const wxString &prog, const int &stepNr, const wxString &arguments, const wxString &description, std::ostream &errStream)
void AddToArray(const wxArrayString &input, wxArrayString &output)
append all strings from input array to output array
wxString GetQuotedFilenamesStringForVerdandi(const wxArrayString &files, const HuginBase::Panorama &pano, const HuginBase::UIntSetVector &stacks, const int referenceImage, const bool hardSeam)
build quoted filename list for verdandi
bool ReplaceWidthHeightPlaceHolder(wxString &args, const wxString name, int value)
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
wxString GetQuotedFilenamesString(const wxArrayString &files)
return a wxString with all files in files quoted
void CleanQueue(CommandQueue *queue)
clean the queue, delete all entries, but not the queue itself
CommandQueue * GetStitchingCommandQueueUserOutput(const HuginBase::Panorama &pano, const wxString &ExePath, const wxString &project, const wxString &prefix, const wxString &outputSettings, wxString &statusText, wxArrayString &outputFiles, wxArrayString &tempFilesDelete, std::ostream &errStream)
generates the command queue for stitching a pano, the commands are parsed from the given executor out...
std::vector< NormalCommand * > CommandQueue
const wxString GetSettingStringTranslated(wxConfigBase *setting, const wxString &name, const wxString defaultValue)
read a translated string from settings and remove all whitespaces
wxString GetInternalProgram(const wxString &bindir, const wxString &name)
return path and name of external program, which comes bundled with Hugin
const wxString GetConfigTempDir(const wxConfigBase *config)
return the temp dir from the preferences, ensure that it ends with path separator
CommandQueue * GetStitchingCommandQueue(const HuginBase::Panorama &pano, const wxString &ExePath, const wxString &project, const wxString &prefix, wxString &statusText, wxArrayString &outputFiles, wxArrayString &tempFilesDelete, std::ostream &errStream)
generates the command queue for stitching a pano it will also generate the necessary exiftool argfile...
const wxString GetSettingString(wxConfigBase *setting, const wxString &name, const wxString defaultValue)
read a string from setting and remove all whitespaces
std::string GetDataDir()
returns the full path to the data directory
std::string GetHuginVersion()
return a string with version numbers
bool set_contains(const _Container &c, const typename _Container::key_type &key)
void fill_set(_Container &c, typename _Container::key_type begin, typename _Container::key_type end)
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.