29#include "wx/clrpicker.h"
41#include "wx/stdpaths.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)
99 wxXmlResource::Get()->LoadPanel(
this,
"perspective_panel");
101 wxXmlResource::Get()->AttachUnknownControl(
"perspective_preview_window",
m_preview,
this);
117#if wxCHECK_VERSION(3,3,2)
156 switch (e.GetSelection())
243 const double cropFactor =
m_srcImage.getCropFactor();
244 if (focallength > 0 && focallength < 10000)
249 if (cropFactor > 0 && cropFactor < 1000)
285 dlg.SetDirectory(path);
289 if (
config->HasEntry(
"lastImageType"))
294 dlg.SetFilterIndex(0);
296 dlg.SetFilterIndex(1);
298 dlg.SetFilterIndex(2);
300 dlg.SetFilterIndex(3);
302 dlg.SetFilterIndex(4);
304 dlg.SetFilterIndex(5);
305 else if (
img_ext ==
"all files")
306 dlg.SetFilterIndex(6);
314 config->Write(
"/actualPath",
dlg.GetDirectory());
316 switch (
dlg.GetFilterIndex())
318 case 0:
config->Write(
"lastImageType",
"all images");
break;
319 case 1:
config->Write(
"lastImageType",
"jpg");
break;
320 case 2:
config->Write(
"lastImageType",
"tiff");
break;
321 case 3:
config->Write(
"lastImageType",
"png");
break;
322 case 4:
config->Write(
"lastImageType",
"hdr");
break;
323 case 5:
config->Write(
"lastImageType",
"exr");
break;
324 case 6:
config->Write(
"lastImageType",
"all files");
break;
354 wxConfigBase::Get()->Write(
"/ToolboxFrame/Perspective/LineColour", e.GetColour().GetAsString(
wxC2S_HTML_SYNTAX));
441 _(
"Project files (*.pto)|*.pto|All files (*)|*"),
445 wxConfig::Get()->Write(
"/actualPath",
dlg.GetDirectory());
447 if (
fn.Right(4).CmpNoCase(
".pto") != 0)
450 if (wxFile::Exists(
fn))
473 dlg.SetDirectory(path);
477 if (
config->HasEntry(
"lastImageType"))
483 dlg.SetFilterIndex(0);
489 dlg.SetFilterIndex(1);
495 dlg.SetFilterIndex(2);
508 config->Write(
"/actualPath",
dlg.GetDirectory());
514 switch (
dlg.GetFilterIndex())
517 config->Write(
"lastImageType",
"jpg");
522 config->Write(
"lastImageType",
"tiff");
526 config->Write(
"lastImageType",
"png");
537 exiftoolArgs.Append(
" -all:all --thumbnail --thumbnailimage --xposition --yposition --orientation --imagefullwidth --imagefullheight ");
569 return _(
"Adjust the rectangle to an area which should be rectangular in the projected image.");
573 return _(
"Create a new line by dragging with left mouse button on a free space.\nExisting lines or line end points can be moved by dragging with left mouse button.\nA line can be deleted by clicking with the right mouse button.");
590 double focallength, cropfactor;
597 if (focallength < 0.1)
614 if (cropfactor < 0.1)
622 hugin_utils::HuginMessageBox(
_(
"The focal length and crop factor result in a invalid value of %d for the horizontal field of view.\nPlease input a valid combination of focal length and crop factor."),
645 std::set<std::string>
imgopt;
basic classes and function for queuing commands in wxWidgets
declaration of functions for finding lines
!! from PTOptimise.h 1951
void registerPTWXDlgFcn()
void deregisterPTWXDlgFcn()
declaration of panel for perspective correction GUI
Dummy progress display, without output.
virtual double getResultHorizontalFOV()
virtual double getResultHeight()
static double calcOptimalPanoScale(const SrcPanoImage &src, const PanoramaOptions &dest)
function to calculate the scaling factor so that the distances in the input image and panorama image ...
virtual void run()
runs the algorithm.
void setHFOV(double h, bool keepView=true)
set the horizontal field of view.
void setProjection(ProjectionFormat f)
set the Projection format and adjust the hfov/vfov if nessecary
void setHeight(unsigned int h)
set panorama height
void setWidth(unsigned int w, bool keepView=true)
set panorama width keep the HFOV, if keepView=true
void setROI(const vigra::Rect2D &val)
unsigned int getWidth() const
double outputExposureValue
void setOptimizeVector(const OptimizeVector &optvec)
set optimize setting
void setCtrlPoints(const CPVector &points)
set all control points (Ippei: Is this supposed to be 'add' method?)
unsigned int addImage(const SrcPanoImage &img)
the the number for a specific image
void setOptions(const PanoramaOptions &opt)
set new output settings This is not used directly for optimizing/stiching, but it can be feed into ru...
const CPVector & getCtrlPoints() const
get all control point of this Panorama
bool WritePTOFile(const std::string &filename, const std::string &prefix="")
write data to given pto file
All variables of a source image.
bool applyEXIFValues(bool applyEVValue=true)
apply values found in EXIF data to SrcPanoImage class, call readEXIF() before to initialize some valu...
bool checkImageSizeKnown()
check if the image size is known, if try to load the information from the file
bool readDistortionFromDB()
tries to read distortion data from lens database you need to call SrcPanoImage::readEXIF before to fi...
static double calcFocalLength(SrcPanoImage::Projection proj, double hfov, double crop, vigra::Size2D imageSize)
calcualte focal length, given crop factor and hfov
bool readCropfactorFromDB()
tries to read cropfactor from lens database you need to call SrcPanoImage::readEXIF before to fill so...
static double calcHFOV(SrcPanoImage::Projection proj, double fl, double crop, vigra::Size2D imageSize)
calculate hfov of an image given focal length, image size and crop factor
bool readEXIF()
try to fill out information about the image, by examining the exif data
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 ClearOutput()
clear the output
file drag and drop handler method
PerspectiveDropTarget(PerspectivePanel *parent)
bool OnDropFiles(wxCoord x, wxCoord y, const wxArrayString &filenames)
PerspectivePanel * m_perspectivePanel
image previewer for perspective correction
void RemoveLines()
remove all lines from the list
ImageCache::EntryPtr getCachedImage()
return pointer to ImageCache
HuginBase::CPVector GetControlPoints(const unsigned int index)
return list of control points
void AddLines(const HuginBase::CPVector &lines)
add the lines to the list
void setOriginalMode()
show the original images with selected zoom ration, the mouse handlers are activated
void setScale(double factor)
set the scaling factor for mask editing display.
bool Create(wxWindow *parent, wxWindowID id=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxTAB_TRAVERSAL, const wxString &name="panel")
creates the control
void ChangeRotation(ImageRotation newRot)
ImageRotation
image rotation.
void SetLineColour(wxColour newColour)
sets the colour for the lines
bool IsOriginalShown() const
void setImage(const std::string &filename, ImageRotation rot)
set the current image and mask list, this loads also the image from cache
void SetRemappedMode(const HuginBase::Panorama &pano)
set the panorama object for remapping, the mouse handler are deactivated
void SetRectMode(bool newMode)
set line or rect mode
void OnColourChanged(wxColourPickerEvent &e)
MyExecPanel * m_logWindow
bool Create(wxWindow *parent, MyExecPanel *logWindow)
create the panel and populate all controls
wxArrayString m_tempFiles
temp files, which should be deleted at end
HuginBase::SrcPanoImage m_srcImage
SrcPanoImage, contains information about the image.
PerspectiveImageCtrl::ImageRotation m_exifRotation
save rotation as written in EXIF
void OnLoadImage(wxCommandEvent &e)
void OnSavePTO(wxCommandEvent &e)
void OnSaveOutput(wxCommandEvent &e)
const PerspectiveImageCtrl::ImageRotation GetRotation() const
return the image rotation
wxChoice * m_rotationChoice
void OnFindLines(wxCommandEvent &e)
wxButton * m_removeLinesButton
void OnRotationChanged(wxCommandEvent &e)
wxTextCtrl * m_cropTextCtrl
void OnZoom(wxCommandEvent &e)
wxTextCtrl * m_focallengthTextCtrl
wxChoice * m_previewChoice
const double GetRoll() const
return the roll angle in degree
void OnModeChanged(wxCommandEvent &e)
wxButton * m_findLineButton
void OnRemoveLines(wxCommandEvent &e)
void SetImage(const wxString &filename)
load the given image
wxString GetStatusString()
return help text for current mode
void OnCropChanged(wxCommandEvent &e)
void OnProcessFinished(wxCommandEvent &e)
clean up temporary files at end
bool ReadInputs()
read the values from the input boxes
PerspectiveImageCtrl * m_preview
controls
void OnLoadDistortion(wxCommandEvent &e)
wxButton * m_outputButton
bool GetPanorama(HuginBase::Panorama &pano, const bool optimized=true)
return Pano object, it is optimized and the crop set when optimized=true
wxStaticText * m_helpTextCtrl
void OnPreview(wxCommandEvent &e)
#define HUGIN_MASK_COLOUR_POINT_SELECTED
std::vector< ControlPoint > CPVector
std::vector< std::set< std::string > > OptimizeVector
HuginBase::CPVector GetVerticalLines(const HuginBase::Panorama &pano, const unsigned int imgNr, vigra::UInt8RGBImage &image, vigra::BImage &mask, const unsigned int nrLines)
searches for vertical control points in given image
HuginBase::CPVector GetLines(const HuginBase::Panorama &pano, const unsigned int imgNr, vigra::UInt8RGBImage &image, vigra::BImage &mask)
searches for all lines, the same as GetVerticalLines execpt that no filtering according to roll angle...
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
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
bool str2double(const wxString &s, double &d)
wxString doubleTowxString(double d, int digits)
bool AskUserOverwrite(const wxString &filename, const wxString &caption, wxWindow *parent)
ask user if the given file should be overwritten, return true if the user confirmed the overwritting
int HuginMessageBox(const wxString &message, const wxString &caption, int style, wxWindow *parent)
std::string getPathPrefix(const std::string &filename)
Get the path to a filename.
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.