28#include "hugin_config.h"
29#include <wx/stdpaths.h>
43#include <pano13/queryfeature.h>
79 wxXmlResource::Get()->LoadPanel(
this,
"panorama_panel");
80 wxPanel *
panel =
XRCCTRL(*
this,
"panorama_panel", wxPanel);
95#ifdef ThisNeverHappens
120 for(
int n=0;
n <
nP;
n++) {
261 wxConfigBase::Get()->Write(
"Stitcher/DefaultRemapper",
m_RemapperChoice->GetSelection());
262 wxConfigBase::Get()->Flush();
314 opt.outputLDRBlended =
false;
315 opt.outputLDRLayers =
false;
317 if (!(
opt.outputLDRExposureBlended ||
318 opt.outputLDRExposureLayers ||
319 opt.outputLDRExposureRemapped ||
320 opt.outputHDRBlended ||
321 opt.outputHDRStacks ||
322 opt.outputHDRLayers)) {
323 opt.outputLDRExposureBlended =
true;
327 opt.outputLDRExposureBlended =
false;
328 opt.outputLDRExposureLayers =
false;
329 opt.outputLDRExposureRemapped =
false;
330 opt.outputHDRBlended =
false;
331 opt.outputHDRStacks =
false;
332 opt.outputHDRLayers =
false;
334 if (!(
opt.outputLDRBlended ||
opt.outputLDRLayers)) {
335 opt.outputLDRBlended =
true;
369 m_WidthTxt->ChangeValue(wxString::Format(
"%d",
opt.getWidth()));
370 m_HeightTxt->ChangeValue(wxString::Format(
"%d",
opt.getHeight()));
372 m_ROILeftTxt->ChangeValue(wxString::Format(
"%d",
opt.getROI().left() ));
374 m_ROITopTxt->ChangeValue(wxString::Format(
"%d",
opt.getROI().top() ));
378 wxString label = wxString::Format(
"%d x %d",
opt.getROI().width(),
opt.getROI().height());
380 if ( (
opt.getROI().width() / 1000.0) *
opt.getROI().height() / 1000.0 >= 20.0)
382 label.Append(wxString::Format(
"=%.0f MP", (
opt.getROI().width() / 1000.0) *
opt.getROI().height() / 1000.0));
386 label.Append(wxString::Format(
"=%.1f MP",
opt.getROI().area() / 1000000.0));
388 if (
opt.getROI().width() >0 &&
opt.getROI().height() > 0)
397 float ratio = 1.0f *
opt.getROI().width() /
opt.getROI().height();
400 label.Append(wxString::Format(
", %.2f:1",
ratio));
404 label.Append(wxString::Format(
", 1:%.2f", 1.0f/
ratio));
413 XRCCTRL(*
this,
"pano_cb_ldr_output_exposure_blended",
wxCheckBox)->SetValue(
opt.outputLDRExposureBlended);
414 XRCCTRL(*
this,
"pano_cb_ldr_output_exposure_layers_fused",
wxCheckBox)->SetValue(
opt.outputLDRExposureLayersFused);
422 XRCCTRL(*
this,
"pano_cb_ldr_output_exposure_remapped",
wxCheckBox)->SetValue(
opt.outputLDRExposureRemapped);
436 XRCCTRL(*
this,
"pano_cb_ldr_output_exposure_layers",
wxCheckBox)->SetValue(
opt.outputLDRExposureLayers);
440 opt.outputLDRLayers ||
441 opt.outputLDRExposureLayers ||
442 opt.outputLDRExposureBlended ||
443 opt.outputLDRExposureLayersFused ||
444 opt.outputLDRExposureRemapped ||
445 opt.outputLDRStacks ||
446 opt.outputHDRBlended ||
447 opt.outputHDRStacks ||
448 opt.outputHDRLayers);
488 opt.outputLDRExposureBlended ||
489 opt.outputLDRExposureLayersFused ||
490 opt.outputLDRExposureLayers ||
529 opt.outputLDRExposureBlended ||
530 opt.outputLDRExposureLayersFused;
539 if (
opt.outputImageType ==
"tif") {
545 if (
opt.outputImageTypeCompression ==
"PACKBITS") {
547 }
else if (
opt.outputImageTypeCompression ==
"LZW") {
549 }
else if (
opt.outputImageTypeCompression ==
"DEFLATE") {
554 }
else if (
opt.outputImageType ==
"jpg") {
561 }
else if (
opt.outputImageType ==
"png") {
566 }
else if (
opt.outputImageType ==
"exr") {
573 wxLogError(
"INTERNAL error: unknown output image type");
589 if (
opt.outputImageTypeHDR ==
"exr") {
593 }
else if (
opt.outputImageTypeHDR ==
"tif") {
597 if (
opt.outputImageTypeHDRCompression ==
"PACKBITS") {
599 }
else if (
opt.outputImageTypeHDRCompression ==
"LZW") {
601 }
else if (
opt.outputImageTypeHDRCompression ==
"DEFLATE") {
607 wxLogError(
"INTERNAL error: unknown hdr output image type");
616 this->Refresh(
false);
657 _(
"Invalid HFOV value. Maximum HFOV for this projection is %lf."),
688 _(
"Invalid VFOV value. Maximum VFOV for this projection is %lf."),
734 wxLogError(
_(
"width needs to be an integer bigger than 0"));
751 wxLogError(
_(
"height needs to be an integer bigger than 0"));
759 long left, right, top, bottom;
761 wxLogError(
_(
"Top needs to be an integer bigger than 0"));
765 wxLogError(
_(
"left needs to be an integer bigger than 0"));
769 wxLogError(
_(
"right needs to be an integer bigger than 0"));
773 wxLogError(
_(
"bottom needs to be an integer bigger than 0"));
776 opt.setROI(vigra::Rect2D(left, top, right, bottom));
779 if(
opt.getROI().width()<1) {
780 wxLogError(
_(
"Left boundary must be smaller than right."));
785 if(
opt.getROI().height()<1) {
786 wxLogError(
_(
"Top boundary must be smaller than bottom."));
831 wxXmlResource::Get()->LoadDialog(&
dlg,
this,
"nona_options_dialog");
836 dlg.CentreOnParent();
849 wxLogError(
_(
"PTmender options not yet implemented"));
868 wxXmlResource::Get()->LoadDialog(&
dlg,
this,
"enblend_options_dialog");
872 dlg.CentreOnParent();
886 wxXmlResource::Get()->LoadDialog(&
dlg,
this,
"verdandi_options_dialog");
888 if (
opt.verdandiOptions.find(
"--seam=blend")!=std::string::npos)
896 dlg.CentreOnParent();
902 opt.verdandiOptions =
"--seam=blend";
906 opt.verdandiOptions =
"";
913 wxLogError(
_(
"PTblender options not yet implemented"));
937 wxXmlResource::Get()->LoadDialog(&
dlg,
this,
"filledge_options_dialog");
940 dlg.CentreOnParent();
959 wxXmlResource::Get()->LoadDialog(&
dlg,
this,
"enfuse_options_dialog");
963 dlg.CentreOnParent();
994 wxLogError(
_(
"Options for this HDRMerge program not yet implemented"));
1011 DEBUG_INFO (
"hfov: " <<
opt.getHFOV() <<
" w: " <<
opt.getWidth() <<
" h: " <<
opt.getHeight() <<
" => vfov: " <<
opt.getVFOV() <<
" before update");
1018 DEBUG_INFO (
"hfov: " <<
opt2.getHFOV() <<
" w: " <<
opt2.getWidth() <<
" h: " <<
opt2.getHeight() <<
" => vfov: " <<
opt2.getVFOV() <<
" after update");
1036 opt.setWidth( width );
1095 if(
tempDir.Last()!=wxFileName::GetPathSeparator())
1096 tempDir.Append(wxFileName::GetPathSeparator());
1109#if defined __WXMAC__ && defined MAC_SELF_CONTAINED_BUNDLE
1114 DEBUG_ERROR(
"hugin_stitch_project could not be found in the bundle.");
1118#elif defined __WXMAC__
1147 list.Add(
dlg.GetPath());
1153 while (!prefix.IsDirWritable())
1155 hugin_utils::HuginMessageBox(wxString::Format(
_(
"You have no permissions to write in folder \"%s\".\nPlease select another folder for the final output."), prefix.GetPath()),
1161 prefix =
dlg.GetPath();
1180 wxConfigBase::Get()->Flush();
1233 bool showDlg=wxConfigBase::Get()->Read(
"ShowSaveMessage", 1l)==1;
1239 wxXmlResource::Get()->LoadDialog(&
dlg,
this,
"stitch_message_dlg");
1244 wxString::Format(
_(
"The project %s will be automatically saved before it can be sent to the batch processor PTBatcherGUI.\nYou will then be asked for the prefix for the panorama output.\n\nYou may need to start the stitching in the batch processor\n PTBatcherGUI if it doesn't start automatically."),
1253 wxConfigBase::Get()->Write(
"ShowSaveMessage", 0l);
1257 wxCommandEvent
dummy;
1283 list.Add(
dlg.GetPath());
1289 while (!prefix.IsDirWritable())
1291 hugin_utils::HuginMessageBox(wxString::Format(
_(
"You have no permissions to write in folder \"%s\".\nPlease select another folder for the final output."), prefix.GetPath()),
1297 prefix =
dlg.GetPath();
1305#if defined __WXMAC__ && defined MAC_SELF_CONTAINED_BUNDLE
1349 if (settings.IsEmpty())
1425 opt.outputImageType =
"png";
1428 opt.outputImageType =
"exr";
1432 opt.outputImageType =
"tif";
1454 opt.outputImageTypeHDR =
"exr";
1480 switch(e.GetSelection()) {
1484 opt.tiffCompression =
"NONE";
1487 opt.outputImageTypeCompression =
"PACKBITS";
1488 opt.tiffCompression =
"PACKBITS";
1491 opt.outputImageTypeCompression =
"LZW";
1492 opt.tiffCompression =
"LZW";
1495 opt.outputImageTypeCompression =
"DEFLATE";
1496 opt.tiffCompression =
"DEFLATE";
1507 switch(e.GetSelection()) {
1513 opt.outputImageTypeHDRCompression =
"PACKBITS";
1516 opt.outputImageTypeHDRCompression =
"LZW";
1519 opt.outputImageTypeHDRCompression =
"DEFLATE";
1532 if (
id ==
XRCID(
"pano_cb_ldr_output_blended") ) {
1534 }
else if (
id ==
XRCID(
"pano_cb_ldr_output_layers") ) {
1536 }
else if (
id ==
XRCID(
"pano_cb_ldr_output_exposure_layers") ) {
1538 }
else if (
id ==
XRCID(
"pano_cb_ldr_output_exposure_blended") ) {
1540 }
else if (
id ==
XRCID(
"pano_cb_ldr_output_exposure_layers_fused") ) {
1542 }
else if (
id ==
XRCID(
"pano_cb_ldr_output_exposure_remapped") ) {
1544 }
else if (
id ==
XRCID(
"pano_cb_ldr_output_stacks") ) {
1546 }
else if (
id ==
XRCID(
"pano_cb_hdr_output_blended") ) {
1548 }
else if (
id ==
XRCID(
"pano_cb_hdr_output_stacks") ) {
1550 }
else if (
id ==
XRCID(
"pano_cb_hdr_output_layers") ) {
1570 wxString::Format(
_(
"The width and height of jpeg images has to be smaller than 65500 pixel. But you have requested a jpeg image with %dx%d pixel.\nThis is not supported by the jpeg file format.\nDecrease the canvas size on the stitch panel or select TIF or PNG as output format."),
cropped_region.width(),
cropped_region.height()),
1577 if (
area > 500000000)
1579 message = wxString::Format(
_(
"The panorama you are trying to stitch is %.1f gigapixels.\nIf this is too big, reduce the panorama Canvas Size and the cropped region and stitch from the Stitcher tab. Stitching a panorama this size could take a long time and a large amount of memory."),
1580 area / 1000000000.0);
1586 message =
_(
"The width or the height of the final panorama exceeds 32700 pixel.\nSome programs have problems to open or display such big images.\n\nIf this is too big, reduce the panorama Canvas Size or the cropped region.");
1596 dialog->SetYesNoLabels(
_(
"Stitch anyway"),
_(
"Let me fix that"));
1597 switch (
dialog->ShowModal())
1624 hugin_utils::HuginMessageBox(
_(
"There are no active images in the output region.\nPlease check your settings, so that at least one image is in the output region."),
1627 return !images.empty();
1640 dialog->SetYesNoLabels(
_(
"Stitch anyway"),
_(
"Let me fix that"));
1663IMPLEMENT_DYNAMIC_CLASS(
PanoPanel, wxPanel)
1666 : wxXmlResourceHandler()
1677 GetPosition(), GetSize(),
Definition of CPImagesComboBox and CPImagesComboBoxXmlHandler class.
wxString GetDataPath()
return path to data directory, it depends on operating system
Definition of dialog for hdrmerge options.
declaration of functions to handle stacks and layers
class to access Hugins camera and lens database
Contains various routines used for stitching panoramas.
Dialog for reset panorama settings.
virtual double getResultHorizontalFOV()
virtual double getResultHeight()
static double calcOptimalScale(PanoramaData &panorama)
virtual void run()
runs the algorithm.
bool outputHDRLayers
save remapped layers (HDR)
bool outputLDRExposureLayers
save blended exposure layers, do not perform fusion (no exposure adjustment)
void setProjection(ProjectionFormat f)
set the Projection format and adjust the hfov/vfov if nessecary
EdgeFillMode
edge fill modes
BlendingMechanism blendMode
bool outputLDRExposureBlended
< save exposure fused stacks (no exposure adjustment)
void setHeight(unsigned int h)
set panorama height
bool outputLDRExposureRemapped
save remapped layers (no exposure adjustment)
const vigra::Rect2D & getROI() const
void setWidth(unsigned int w, bool keepView=true)
set panorama width keep the HFOV, if keepView=true
void setROI(const vigra::Rect2D &val)
EdgeFillMode edgeFillMode
bool outputLDRBlended
save blended panorama (LDR)
bool outputLDRLayers
save remapped layers (LDR)
bool outputHDRStacks
save image stacks (HDR)
BlendingMechanism
blenders
ProjectionFormat
Projection of final panorama.
bool outputLDRExposureLayersFused
save blended exposure layers which are then fused (no exposure adjustment)
std::string outputImageType
std::string outputImageTypeHDRCompression
std::string outputImageTypeHDR
std::string outputImageTypeCompression
bool outputHDRBlended
save blended panorama (HDR)
const PanoramaOptions & getOptions() const
returns the options for this panorama
bool isDirty() const
true if there are unsaved changes
void addObserver(PanoramaObserver *o)
add a panorama observer.
void setOptions(const PanoramaOptions &opt)
set new output settings This is not used directly for optimizing/stiching, but it can be feed into ru...
bool removeObserver(PanoramaObserver *observer)
remove a panorama observer.
bool WritePTOFile(const std::string &filename, const std::string &prefix="")
write data to given pto file
UIntSet getActiveImages() const
get active images
std::size_t getNrOfImages() const
number of images.
static MainFrame * Get()
hack.. kind of a pseudo singleton...
void OnSaveProject(wxCommandEvent &e)
wxString getProjectName()
void DisplayHelp(wxString section=wxEmptyString)
call help browser with given file
void addCommand(PanoCommand *command, bool execute=true)
Adds a command to the history.
static GlobalCmdHist & getInstance()
virtual wxObject * DoCreateResource()
virtual bool CanHandle(wxXmlNode *node)
Define the pano edit panel.
virtual void panoramaChanged(HuginBase::Panorama &pano)
this is called whenever the panorama has changed.
wxTextCtrl * m_ROIRightTxt
void HFOVChanged(wxCommandEvent &e)
void OnHDRMergeOptions(wxCommandEvent &e)
void DoCalcFOV(wxCommandEvent &e)
bool CheckFreeSpace(const wxString &folder)
check if there is enough free disk space
wxButton * m_CalcOptWidthButton
wxChoice * m_FileFormatChoice
wxChoice * m_HDRMergeChoice
bool CheckGoodSize()
Check the canvas size isn't overly huge, or the user knows what they are doing.
void DoCalcOptimalWidth(wxCommandEvent &e)
set the highest sensible width
void FileFormatChanged(wxCommandEvent &e)
void OnDoStitch(wxCommandEvent &e)
void BlenderChanged(wxCommandEvent &e)
wxTextCtrl * m_FileFormatJPEGQualityText
void DoSendToBatch(const wxString &userDefinedSetting=wxEmptyString)
stitching with PTBatcherGUI
void EnableControls(bool enable)
enable/disable control influenced by quick mode
bool CheckHasImages()
check if the output contains images at all
void OnJPEGQualityText(wxCommandEvent &e)
void ProjectionChanged(wxCommandEvent &e)
wxScrolledWindow * m_pano_ctrls
wxChoice * m_ProjectionChoice
void DoStitchOrSendBatch(const wxString &userDefinedSetting=wxEmptyString)
general stitching command, selects PTBatcherGUI or hugin_stitch_project depending on the settings in ...
void ROIChanged(wxCommandEvent &e)
HuginBase::PanoramaOptions m_oldOpt
void OnOutputFilesChanged(wxCommandEvent &e)
wxTextCtrl * m_ROIBottomTxt
void OnFusionOptions(wxCommandEvent &e)
wxChoice * m_edgeFillChoice
void OnNormalTIFFCompression(wxCommandEvent &e)
wxChoice * m_FileFormatTIFFCompChoice
wxChoice * m_FileFormatHDRTIFFCompChoice
wxButton * m_CalcOptROIButton
void Init(HuginBase::Panorama *pano)
wxChoice * m_HDRFileFormatChoice
wxButton * m_CalcHFOVButton
bool StackCheck(HuginBase::Panorama &pano)
void OnEdgeFillChanged(wxCommandEvent &e)
void UpdateDisplay(const HuginBase::PanoramaOptions &opt, const bool hasStacks)
void HDRMergeChanged(wxCommandEvent &e)
void HeightChanged(wxCommandEvent &e)
bool Create(wxWindow *parent, wxWindowID id=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxTAB_TRAVERSAL, const wxString &name="panel")
void VFOVChanged(wxCommandEvent &e)
void OnBlenderOptions(wxCommandEvent &e)
void OnRemapperOptions(wxCommandEvent &e)
wxButton * m_StitchButton
void FusionChanged(wxCommandEvent &e)
void RemapperChanged(wxCommandEvent &e)
void SetGuiLevel(GuiLevel newGuiLevel)
wxTextCtrl * m_ROILeftTxt
void DoStitch(const wxString &userDefinedSetting=wxEmptyString, const bool readSetting=true)
stitching using hugin_stitch_project
wxChoice * m_BlenderChoice
wxStaticText * m_HDRFileFormatLabelTIFFCompression
void DoUserDefinedStitch(const wxString &settings=wxString())
stitching with user defined file
void WidthChanged(wxCommandEvent &e)
wxChoice * m_RemapperChoice
void DoCalcOptimalROI(wxCommandEvent &e)
set the largest rectangle for crop ROI
void HDRFileFormatChanged(wxCommandEvent &e)
wxChoice * m_FusionChoice
void OnEdgeFillOptions(wxCommandEvent &e)
HuginBase::Panorama * pano
wxStaticText * m_FileFormatOptionsLabel
void OnHDRTIFFCompression(wxCommandEvent &e)
Handle EVT_KILL_FOCUS and convert it to a EVT_TEXT_ENTER event.
#define HUGIN_PROCESSOR_VERBOSE
#define HUGIN_PROCESSOR_GUI
#define HUGIN_PROCESSOR_START
#define HUGIN_ASS_PANO_DOWNSIZE_FACTOR
#define HUGIN_PROCESSOR_OVERWRITE
wxString getDefaultOutputName(const wxString projectname, const HuginBase::Panorama &pano, const wxString filenameTemplate)
gets the default output prefix, based on filename and images in project the setting is read from the ...
functions for interaction with the hugin configuration file
misc math function & classes used by other parts of the program
#define DEBUG_ASSERT(cond)
bool SaveLensDataFromPano(const HuginBase::Panorama &pano)
routine for automatically saving information from pano into database
std::set< unsigned int > UIntSet
std::vector< UIntSet > getHDRStacks(const PanoramaData &pano, UIntSet allImgs, PanoramaOptions opts)
returns vector of set of output stacks
bool str2double(const wxString &s, double &d)
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 doubleToString(double d, int digits)
convert a double to a string, suitable for display within a GUI.
std::unique_ptr< wxMessageDialogBase > MessageDialog
str wxQuoteString(const str &arg)
Try to escape special chars on windows and linux.
int gcd(int a, int b)
function to calculate greated common divisor using Euclidean algorithm both arguments should be >=0
MessageDialog GetMessageDialog(const wxString &message, const wxString &caption, int style, wxWindow *parent)
Interpolator
enum with all interpolation methods
include file for the hugin project
include file for the hugin project
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.