40#include <exiv2/exiv2.hpp>
67 if(IsEnabled(pano, images, m_guiLevel))
69 return GetInternalCommand(
parent,pano,images);
79 return images.size()==1;
84 return !images.empty();
101 dlg.SetDirectory(path);
105 if (
config->HasEntry(
"lastImageType"))
111 dlg.SetFilterIndex(0);
118 dlg.SetFilterIndex(1);
120 dlg.SetFilterIndex(2);
122 dlg.SetFilterIndex(3);
124 dlg.SetFilterIndex(4);
126 dlg.SetFilterIndex(5);
127 else if (
img_ext ==
"all files")
128 dlg.SetFilterIndex(6);
133 dlg.SetFilterIndex(1);
135 dlg.SetFilterIndex(2);
137 dlg.SetFilterIndex(3);
139 dlg.SetFilterIndex(4);
141 dlg.SetFilterIndex(5);
143 dlg.SetFilterIndex(6);
159 config->Write(
"/actualPath",
dlg.GetDirectory());
164 switch (
dlg.GetFilterIndex())
166 case 0:
config->Write(
"lastImageType",
"all images");
break;
167 case 1:
config->Write(
"lastImageType",
"jpg");
break;
168 case 2:
config->Write(
"lastImageType",
"tiff");
break;
169 case 3:
config->Write(
"lastImageType",
"png");
break;
170 case 4:
config->Write(
"lastImageType",
"hdr");
break;
171 case 5:
config->Write(
"lastImageType",
"exr");
break;
172 case 6:
config->Write(
"lastImageType",
"all files");
break;
177 switch (
dlg.GetFilterIndex())
179 case 0:
config->Write(
"lastImageType",
"all images");
break;
180 case 1:
config->Write(
"lastImageType",
"all raws");
break;
181 case 2:
config->Write(
"lastImageType",
"jpg");
break;
182 case 3:
config->Write(
"lastImageType",
"tiff");
break;
183 case 4:
config->Write(
"lastImageType",
"png");
break;
184 case 5:
config->Write(
"lastImageType",
"hdr");
break;
185 case 6:
config->Write(
"lastImageType",
"exr");
break;
215 return _(
"Add individual images...");
220 std::vector<std::string> files;
228 if (files.size() == 1)
232 message->SetYesNoLabels(
_(
"Convert anyway"),
_(
"Let me select several raw files"));
243 if (
dlg.CheckRawFiles())
248 return dlg.GetPanoCommand();
266#if defined EXIV2_VERSION && EXIV2_TEST_VERSION(0,27,99)
267 Exiv2::Image::UniquePtr image;
269 Exiv2::Image::AutoPtr image;
273 image = Exiv2::ImageFactory::open(filename);
279 if (image.get() == 0)
286 image->readMetadata();
288 catch (
const Exiv2::Error& e)
290 std::cerr <<
"Exiv2: Error reading metadata (" << e.what() <<
")" << std::endl;
293 Exiv2::ExifData &
exifData = image->exifData();
299 Exiv2::Exifdatum&
tag =
exifData[
"Exif.Image.DateTime"];
316 when.tm_year -= 1900;
346 return _(
"Add time-series of images...");
352 std::vector<std::string> files;
370 files.push_back(pano.
getImage(
i).getFilename());
379 for(
size_t i=0;
i<files.size();
i++)
387 while (!file.IsEmpty())
390 if(vigra::isImage(files[
i].
c_str()))
401 StringToPointerHash::iterator
found;
402 std::map<std::string, time_t>
timeMap;
428 for(
size_t i=0;
i<files.size();
i++)
441 files.push_back(file);
453 sort(files.begin(), files.end(),
spred);
466 return _(
"Manipulate image variables...");
474 const std::string expression =
dlg.GetExpression();
475 if (!expression.empty())
490 return _(
"Remove selected image(s)");
496 for (HuginBase::UIntSet::iterator
it = images.begin();
it != images.end(); ++
it)
505 return _(
"Anchor this image for position");
517 return _(
"Anchor this image for exposure");
542 return _(
"New lens");
566 return _(
"Change lens...");
573 _(
"Enter new lens number"),
575 _(
"Change lens number"), 0, 0,
583 for (
const auto& img : images)
587 hugin_utils::HuginMessageBox(wxString::Format(
_(
"Selected images and selected lens have different sizes. All images of the same lens should have the same size.\n\nImage %d has size %dx%d, while lens %d has images with size of %dx%d pixel."),
610 return _(
"Load lens from lens database");
614 return _(
"Load lens from ini file");
674 return _(
"Save lens parameters to lens database");
678 return _(
"Save lens to ini file");
684 unsigned int imgNr = *(images.begin());
698 return _(
"Remove control points");
719 for (HuginBase::CPVector::const_iterator
it = cps.begin();
it != cps.end(); ++
it)
744 return _(
"Clean control points");
762 std::map<size_t,size_t>
cpMap;
779 if (!
progress.updateDisplayValue(
_(
"Checking whole project")))
783 if (
graph.IsConnected())
796 if (!
progress.updateDisplay(
_(
"Finished cleaning")))
810 return _(
"Remove control points on clouds");
816 progress.updateDisplay(
_(
"Loading model file"));
832 int radius=(
t)?10:20;
836 for (HuginBase::UIntSet::const_iterator
it=images.begin();
it!=images.end(); ++
it)
849 vigra::UInt16RGBImage in;
850 if(img->image16->width()>0)
852 in.resize(img->image16->size());
858 in.resize(
im8->size());
861 if (!img->iccProfile->empty())
865 if (!
progress.updateDisplay(
_(
"Running Celeste")))
882 if (!
progress.updateDisplayValue(
_(
"Loading images")))
931 return _(
"Reset user defined...");
934 return _(
"Reset positions");
937 return _(
"Reset translation parameters");
940 return _(
"Reset lens parameters");
943 return _(
"Reset photometric parameters");
985 for(HuginBase::UIntSet::const_iterator
it = images.begin();
it != images.end(); ++
it)
987 unsigned int imgNr = *
it;
1012 double cropFactor=
srcImg.getExifCropFactor();
1037 double eV=
srcImg.calcExifExposureValue();
1058 if(img.getExifMake() ==
anchor.getExifMake() &&
1059 img.getExifModel() ==
anchor.getExifModel())
1202 return _(
"New stack");
1226 return _(
"Change stack...");
1233 _(
"Enter new stack number"),
1235 _(
"Change stack number"), 0, 0,
1243 for (
const auto& img : images)
1247 hugin_utils::HuginMessageBox(wxString::Format(
_(
"Selected images and selected stack have different sizes. All images of the same stack should have the same size.\n\nImage %d has size %dx%d, while stack %d has images with size of %dx%d pixel."),
1269 return _(
"Set stack size...");
1276 wxXmlResource::Get()->LoadDialog(&
dlg,
parent,
"stack_size_dialog");
1283 linkCheckBox->SetValue(
cfg->Read(
"/StackDialog/LinkPosition",
true) != 0l);
1297 std::vector<PanoCommand::PanoCommand *> commands;
1332 std::set<HuginBase::ImageVariableGroup::ImageVariableEnum> variables;
1333 variables.insert(HuginBase::ImageVariableGroup::IVE_Yaw);
1334 variables.insert(HuginBase::ImageVariableGroup::IVE_Pitch);
1335 variables.insert(HuginBase::ImageVariableGroup::IVE_Roll);
1336 variables.insert(HuginBase::ImageVariableGroup::IVE_X);
1337 variables.insert(HuginBase::ImageVariableGroup::IVE_Y);
1338 variables.insert(HuginBase::ImageVariableGroup::IVE_Z);
1339 variables.insert(HuginBase::ImageVariableGroup::IVE_TranslationPlaneYaw);
1340 variables.insert(HuginBase::ImageVariableGroup::IVE_TranslationPlanePitch);
1412 for(
size_t i=0;
i<
vec.size();
i++)
Definition of dialog to edit image variables by parsing an expression.
algorithms for remove control points by statistic method
void registerPTWXDlgFcn()
void deregisterPTWXDlgFcn()
Definition of PanoOperation class.
Definition of dialog and functions to import RAW images to project file.
Definition of ResetDialog class.
static const std::set< ConstImageVariableGroup::ImageVariableEnum > & getLensVariables()
Get the set of lens image variables.
static const std::set< ConstImageVariableGroup::ImageVariableEnum > & getStackVariables()
Get the set of stack image variables.
represents a control point
std::shared_ptr< vigra::BRGBImage > ImageCacheRGB8Ptr
use reference counted pointers
static ImageCache & getInstance()
get the global ImageCache object
EntryPtr getImage(const std::string &filename)
get a image.
void removeImage(const std::string &filename)
remove a specific image (and dependant images) from the cache
std::shared_ptr< Entry > EntryPtr
a shared pointer to the entry
unsigned int optimizeReferenceImage
unsigned int colorReferenceImage
const VariableMap getImageVariables(unsigned int imgNr) const
Get the variables of an image.
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
CPointVector getCtrlPointsVectorForImage(unsigned int imgNr) const
return a vector of std::pairs with global ctrl point nr and ControlPoint In the class ControlPoint th...
void setCtrlPoints(const CPVector &points)
set all control points (Ippei: Is this supposed to be 'add' method?)
SrcPanoImage getSrcImage(unsigned imgNr) const
get a description of a source image
std::size_t getNrOfCtrlPoints() const
number of control points
const CPVector & getCtrlPoints() const
get all control point of this Panorama
Panorama duplicate() const
duplicate the panorama
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.
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
class to work with images graphs created from a HuginBase::Panorama class it creates a graph based on...
Dialog for editing expression to change image variables.
static MainFrame * Get()
hack.. kind of a pseudo singleton...
struct celeste::svm_model * GetSVMModel()
Change the linking of some variables across parts of an ImageVariableGroup containing some specified ...
Switch the part number of an image.
PanoCommand to combine other PanoCommands.
Make a new part in a ImageVariableGroup for a set of images, given the variables that make up the gro...
Base class for all panorama commands.
remove several control points
remove multiple images from a panorama
reset output exposure to mean exposure of all images
update variables of a group of images
update variables by parsing a expression
add image(s) to a panorama
PanoOperation to add several user selected images to the panorama.
virtual PanoCommand::PanoCommand * GetInternalCommand(wxWindow *parent, HuginBase::Panorama &pano, HuginBase::UIntSet images)
main working function, overwrite it in derived classes
virtual wxString GetLabel()
PanoOperation to add all image in a defined timeinterval to the panorama.
virtual wxString GetLabel()
virtual PanoCommand::PanoCommand * GetInternalCommand(wxWindow *parent, HuginBase::Panorama &pano, HuginBase::UIntSet images)
main working function, overwrite it in derived classes
PanoOperation to assigns stacks.
virtual PanoCommand::PanoCommand * GetInternalCommand(wxWindow *parent, HuginBase::Panorama &pano, HuginBase::UIntSet images)
main working function, overwrite it in derived classes
virtual bool IsEnabled(HuginBase::Panorama &pano, HuginBase::UIntSet images, GuiLevel guiLevel)
return true, if operation is enabled with the given image set
virtual wxString GetLabel()
PanoOperation to clean control points with Celeste.
virtual PanoCommand::PanoCommand * GetInternalCommand(wxWindow *parent, HuginBase::Panorama &pano, HuginBase::UIntSet images)
main working function, overwrite it in derived classes
virtual wxString GetLabel()
PanoOperation to change anchor image.
virtual PanoCommand::PanoCommand * GetInternalCommand(wxWindow *parent, HuginBase::Panorama &pano, HuginBase::UIntSet images)
main working function, overwrite it in derived classes
virtual wxString GetLabel()
PanoOperation to change exposure anchor image.
virtual wxString GetLabel()
virtual PanoCommand::PanoCommand * GetInternalCommand(wxWindow *parent, HuginBase::Panorama &pano, HuginBase::UIntSet images)
main working function, overwrite it in derived classes
PanoOperation to change lens number.
virtual PanoCommand::PanoCommand * GetInternalCommand(wxWindow *parent, HuginBase::Panorama &pano, HuginBase::UIntSet images)
main working function, overwrite it in derived classes
virtual bool IsEnabled(HuginBase::Panorama &pano, HuginBase::UIntSet images, GuiLevel guiLevel)
return true, if operation is enabled with the given image set
virtual wxString GetLabel()
PanoOperation to change lens number.
virtual wxString GetLabel()
virtual PanoCommand::PanoCommand * GetInternalCommand(wxWindow *parent, HuginBase::Panorama &pano, HuginBase::UIntSet images)
main working function, overwrite it in derived classes
virtual bool IsEnabled(HuginBase::Panorama &pano, HuginBase::UIntSet images, GuiLevel guiLevel)
return true, if operation is enabled with the given image set
PanoOperation to clean control points with statistically method.
virtual wxString GetLabel()
virtual bool IsEnabled(HuginBase::Panorama &pano, HuginBase::UIntSet images, GuiLevel guiLevel)
return true, if operation is enabled with the given image set
virtual PanoCommand::PanoCommand * GetInternalCommand(wxWindow *parent, HuginBase::Panorama &pano, HuginBase::UIntSet images)
main working function, overwrite it in derived classes
PanoOperation to modify image variables by parsing an expression.
virtual bool IsEnabled(HuginBase::Panorama &pano, HuginBase::UIntSet images, GuiLevel guiLevel)
return true, if operation is enabled with the given image set
virtual wxString GetLabel()
virtual PanoCommand::PanoCommand * GetInternalCommand(wxWindow *parent, HuginBase::Panorama &pano, HuginBase::UIntSet images)
main working function, overwrite it in derived classes
PanoOperation to load lens from ini file or lens database.
LoadLensOperation(bool fromDatabase)
virtual wxString GetLabel()
virtual PanoCommand::PanoCommand * GetInternalCommand(wxWindow *parent, HuginBase::Panorama &pano, HuginBase::UIntSet images)
main working function, overwrite it in derived classes
PanoOperation to assign new lens.
virtual bool IsEnabled(HuginBase::Panorama &pano, HuginBase::UIntSet images, GuiLevel guiLevel)
return true, if operation is enabled with the given image set
virtual PanoCommand::PanoCommand * GetInternalCommand(wxWindow *parent, HuginBase::Panorama &pano, HuginBase::UIntSet images)
main working function, overwrite it in derived classes
virtual wxString GetLabel()
PanoOperation to assign new stack.
virtual wxString GetLabel()
virtual bool IsEnabled(HuginBase::Panorama &pano, HuginBase::UIntSet images, GuiLevel guiLevel)
return true, if operation is enabled with the given image set
virtual PanoCommand::PanoCommand * GetInternalCommand(wxWindow *parent, HuginBase::Panorama &pano, HuginBase::UIntSet images)
main working function, overwrite it in derived classes
virtual bool IsEnabled(HuginBase::Panorama &pano, HuginBase::UIntSet images, GuiLevel guiLevel)
return true, if operation is enabled with the given image set
virtual bool IsEnabled(HuginBase::Panorama &pano, HuginBase::UIntSet images, GuiLevel guiLevel)
return true, if operation is enabled with the given image set
virtual wxString GetLabel()
virtual PanoCommand::PanoCommand * GetCommand(wxWindow *parent, HuginBase::Panorama &pano, HuginBase::UIntSet images, GuiLevel guiLevel)
returns the appropriate PanoCommand::PanoCommand to be inserted into GlobalCmdHistory,...
virtual bool IsEnabled(HuginBase::Panorama &pano, HuginBase::UIntSet images, GuiLevel guiLevel)
return true, if operation is enabled with the given image set
PanoOperation to remove control points.
virtual bool IsEnabled(HuginBase::Panorama &pano, HuginBase::UIntSet images, GuiLevel guiLevel)
return true, if operation is enabled with the given image set
virtual wxString GetLabel()
virtual PanoCommand::PanoCommand * GetInternalCommand(wxWindow *parent, HuginBase::Panorama &pano, HuginBase::UIntSet images)
main working function, overwrite it in derived classes
PanoOperation to remove selected images.
virtual wxString GetLabel()
virtual PanoCommand::PanoCommand * GetInternalCommand(wxWindow *parent, HuginBase::Panorama &pano, HuginBase::UIntSet images)
main working function, overwrite it in derived classes
PanoOperation to reset image variables.
virtual bool IsEnabled(HuginBase::Panorama &pano, HuginBase::UIntSet images, GuiLevel guiLevel)
return true, if operation is enabled with the given image set
bool m_resetCameraResponse
virtual PanoCommand::PanoCommand * GetInternalCommand(wxWindow *parent, HuginBase::Panorama &pano, HuginBase::UIntSet images)
main working function, overwrite it in derived classes
@ RESET_DIALOG_PHOTOMETRICS
virtual wxString GetLabel()
bool ShowDialog(wxWindow *parent)
ResetOperation(ResetMode newResetMode)
PanoOperation to save lens to ini file or database.
virtual PanoCommand::PanoCommand * GetInternalCommand(wxWindow *parent, HuginBase::Panorama &pano, HuginBase::UIntSet images)
main working function, overwrite it in derived classes
SaveLensOperation(bool toDatabase)
virtual wxString GetLabel()
Dialog for reset panorama settings.
functions to handle icc profiles in images
#define HUGIN_CELESTE_FILTER
#define HUGIN_CAPTURE_TIMESPAN
#define HUGIN_CELESTE_THRESHOLD
void ApplyICCProfile(ImageType &image, const vigra::ImageImportInfo::ICCProfile &iccProfile, const cmsUInt32Number imageFormat)
converts given image with iccProfile to sRGB/gray space, need to give pixel type in lcms2 format work...
std::vector< VariableMap > VariableMapVector
std::vector< ControlPoint > CPVector
std::vector< CPoint > CPointVector
std::set< unsigned int > UIntSet
std::map< std::string, Variable > VariableMap
PanoOperationVector * GetStacksOperationVector()
returns list of PanoOperation for stacks
PanoOperationVector * GetImagesOperationVector()
returns list of PanoOperation for work with images
bool AddImageDialog(wxWindow *parent, std::vector< std::string > &files, bool &withRaws)
small function to show add image dialog
static PanoOperationVector PanoOpLens
static PanoOperationVector PanoOpControlPoints
std::vector< PanoOperation * > PanoOperationVector
static PanoOperationVector PanoOpReset
PanoOperationVector * GetControlPointsOperationVector()
returns list of PanoOperation for work with control points
time_t ReadExifTime(const char *filename)
PanoOperationVector * GetLensesOperationVector()
returns list of PanoOperation for work with lenses
WX_DECLARE_STRING_HASH_MAP(time_t, StringToPointerHash)
static PanoOperationVector PanoOpImages
PanoOperationVector * GetResetOperationVector()
returns list of PanoOperation for resetting
void _CleanPanoOperationVector(PanoOperationVector &vec)
void GeneratePanoOperationVector()
generates the PanoOperationVector for context menu
static PanoOperationVector PanoOpStacks
void CleanPanoOperationVector()
clears the PanoOperationVector
HuginBase::UIntSet getCelesteControlPoints(struct svm_model *model, vigra::UInt16RGBImage &input, HuginBase::CPointVector cps, int radius, float threshold, int resize_dimension, bool verbose)
int HuginMessageBox(const wxString &message, const wxString &caption, int style, wxWindow *parent)
std::unique_ptr< wxMessageDialogBase > MessageDialog
MessageDialog GetMessageDialog(const wxString &message, const wxString &caption, int style, wxWindow *parent)
void copyImage(SrcImageIterator src_upperleft, SrcImageIterator src_lowerright, SrcAccessor src_acc, DestImageIterator dest_upperleft, DestAccessor dest_acc)
void transformImage(SrcImageIterator src_upperleft, SrcImageIterator src_lowerright, SrcAccessor src_acc, DestImageIterator dest_upperleft, DestAccessor dest_acc, const Functor &func)
bool set_contains(const _Container &c, const typename _Container::key_type &key)
Map::mapped_type & map_get(Map &m, const typename Map::key_type &key)
get a map element.
void fill_set(_Container &c, typename _Container::key_type begin, typename _Container::key_type end)
sortbytime(std::map< std::string, time_t > &h)
std::map< std::string, time_t > & m_time
bool operator()(const std::string &s1, const std::string &s2)
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.
bool ApplyLensDBParameters(wxWindow *parent, HuginBase::Panorama *pano, HuginBase::UIntSet images, PanoCommand::PanoCommand *&cmd)
loads the lens parameters from lens database and create approbiate PanoCommand::PanoCommand to apply ...
dialogs for loading and saving information from/to lens database
wxwindows specific panorama commands