28 #include "hugin_config.h"
58 EVT_TREE_SEL_CHANGED(XRCID("images_tree_ctrl"),
ImagesPanel::OnSelectionChanged )
59 EVT_CHOICE ( XRCID("images_lens_type"),
ImagesPanel::OnLensTypeChanged)
60 EVT_CHOICE ( XRCID("images_group_mode"),
ImagesPanel::OnGroupModeChanged)
61 EVT_RADIOBOX ( XRCID("images_column_radiobox"),
ImagesPanel::OnDisplayModeChanged)
62 EVT_CHOICE ( XRCID("images_optimize_mode"),
ImagesPanel::OnOptimizerSwitchChanged)
63 EVT_CHOICE ( XRCID("images_photo_optimize_mode"),
ImagesPanel::OnPhotometricOptimizerSwitchChanged)
64 EVT_TEXT_ENTER ( XRCID("images_focal_length"),
ImagesPanel::OnFocalLengthChanged)
65 EVT_TEXT_ENTER ( XRCID("images_crop_factor"),
ImagesPanel::OnCropFactorChanged)
66 EVT_TEXT_ENTER ( XRCID("images_overlap"),
ImagesPanel::OnMinimumOverlapChanged)
67 EVT_TEXT_ENTER ( XRCID("images_maxev"),
ImagesPanel::OnMaxEvDiffChanged)
68 EVT_BUTTON ( XRCID("images_feature_matching"),
ImagesPanel::CPGenerate)
69 EVT_BUTTON ( XRCID("images_optimize"),
ImagesPanel::OnOptimizeButton)
70 EVT_BUTTON ( XRCID("images_photo_optimize"),
ImagesPanel::OnPhotometricOptimizeButton)
80 long style,
const wxString& name)
82 if (! wxPanel::Create(parent,
id, pos, size, style, name)) {
86 wxXmlResource::Get()->LoadPanel(
this, wxT(
"images_panel"));
87 wxPanel * panel = XRCCTRL(*
this,
"images_panel", wxPanel);
88 wxBoxSizer *topsizer =
new wxBoxSizer( wxVERTICAL );
89 topsizer->Add(panel, 1, wxEXPAND, 0);
103 m_smallImgCtrl = XRCCTRL(*
this,
"images_selected_image", wxStaticBitmap);
108 wxImage image(1, 1,
true);
109 const wxColour imageBackgroundColor =
m_smallImgCtrl->GetBackgroundColour();
110 image.SetRGB(0, 0, imageBackgroundColor.Red(), imageBackgroundColor.Green(), imageBackgroundColor.Blue());
114 m_lenstype = XRCCTRL(*
this,
"images_lens_type", wxChoice);
119 m_focallength = XRCCTRL(*
this,
"images_focal_length", wxTextCtrl);
123 m_cropfactor = XRCCTRL(*
this,
"images_crop_factor", wxTextCtrl);
127 m_overlap = XRCCTRL(*
this,
"images_overlap", wxTextCtrl);
131 m_maxEv = XRCCTRL(*
this,
"images_maxev", wxTextCtrl);
141 m_optChoice = XRCCTRL(*
this,
"images_optimize_mode", wxChoice);
149 wxConfigBase* config=wxConfigBase::Get();
150 m_degDigits = config->Read(wxT(
"/General/DegreeFractionalDigitsEdit"),3);
175 if(cb->HasClientUntypedData())
177 for(
size_t i = 0; i < cb->GetCount(); i++)
179 delete static_cast<int*
>(cb->GetClientData(i));
190 m_maxEv->PopEventHandler(
true);
192 wxChoice* group=XRCCTRL(*
this,
"images_group_mode", wxChoice);
206 int winWidth, winHeight;
207 GetClientSize(&winWidth, &winHeight);
208 DEBUG_INFO(
"image panel: " << winWidth <<
"x"<< winHeight );
218 int found=wxNOT_FOUND;
221 if(optSwitch==*static_cast<int*>(
m_optChoice->GetClientData(i)))
227 if(found==wxNOT_FOUND)
249 if(found==wxNOT_FOUND)
270 DEBUG_DEBUG(
"nr of sel Images: " << selected.size());
283 XRCCTRL(*
this,
"images_optimize", wxButton)->Enable(pano.
getNrOfImages()>0);
284 XRCCTRL(*
this,
"images_photo_optimize", wxButton)->Enable(pano.
getNrOfImages()>1);
295 if ((selImg.empty()) || (selImg.size() == 1 && progName.Find(wxT(
"linefind")) == wxNOT_FOUND))
316 wxConfigBase* config=wxConfigBase::Get();
318 if(wxGetKeyState(WXK_COMMAND))
321 nFeatures = wxGetNumberFromUser(
322 _(
"Enter maximal number of control points per image pair"),
323 _(
"Points per Overlap"),
324 _(
"Control point detector option"),
331 config->Write(wxT(
"/MainFrame/nControlPoints"), nFeatures);
341 wxMessageBox(wxString::Format(_(
"Added %lu control points"), (
unsigned long) cps.size()), _(
"Control point detector result"),wxOK|wxICON_INFORMATION,
this);
367 bool identical_projection=
true;
370 img.getCropFactor(),img.getSize());;
371 double cropFactor=img.getCropFactor();
372 for (HuginBase::UIntSet::const_iterator it = sel.begin(); it != sel.end(); ++it)
375 if(proj!=img2.getProjection())
377 identical_projection=
false;
380 img2.getCropFactor(),img2.getSize());
381 if(focallength>0 && fabs(focallength-focallength2)>0.05)
385 if(fabs(cropFactor-img2.getCropFactor())>0.1)
391 if(identical_projection)
461 ImageCache::EntryPtr cacheEntry = ImageCache::getInstance().getSmallImageIfAvailable(
463 if (!cacheEntry.get())
480 double iRatio = img.GetWidth() / (double) img.GetHeight();
486 double sRatio = (double)sz.GetWidth() / sz.GetHeight();
487 if (iRatio > sRatio) {
489 sz.SetHeight((
int) (sz.GetWidth() / iRatio));
492 sz.SetWidth((
int) (sz.GetHeight() * iRatio));
496 sz.IncTo(wxSize(1,1));
497 wxImageResizeQuality resizeQuality = wxIMAGE_QUALITY_NORMAL;
498 if (
std::max(img.GetWidth(), img.GetHeight()) > (ULONG_MAX >> 16))
504 resizeQuality = wxIMAGE_QUALITY_BOX_AVERAGE;
506 wxImage scaled = img.Scale(sz.GetWidth(),sz.GetHeight(), resizeQuality);
512 wxBitmap scaledBitmap(scaled);
538 std::vector<PanoCommand::PanoCommand*> commands;
545 if (wxConfig::Get()->Read(wxT(
"/ShowFisheyeCropHint"), 1l) == 1 &&
553 wxXmlResource::Get()->LoadDialog(&dlg, NULL, wxT(
"fisheye_show_crop_dlg"));
554 if (dlg.ShowModal() == wxID_OK)
558 if (XRCCTRL(dlg,
"fisheye_crop_dont_ask_checkbox", wxCheckBox)->IsChecked())
560 wxConfig::Get()->Write(wxT(
"/ShowFisheyeCropHint"), 0l);
594 double hfov=srcImg.
calcHFOV(srcImg.getProjection(), val, srcImg.getCropFactor(), srcImg.getSize());
598 wxString::Format(_(
"You have given a field of view of %.2f degrees.\n But the orthographic projection is limited to a field of view of 180 degress.\nDo you want still use that high value?"), hfov),
604 wxICON_EXCLAMATION | wxYES_NO)==wxNO)
659 if(fabs(val)<0.001 || val>1)
661 wxMessageBox(_(
"The minimum overlap has to be greater than 0 and smaller than 1."),
667 wxOK | wxICON_INFORMATION,
this);
683 wxString text =
m_maxEv->GetValue();
695 wxMessageBox(_(
"The maximum Ev difference has to be greater than 0."),
701 wxOK | wxICON_INFORMATION,
this);
713 wxChoice* group=XRCCTRL(*
this,
"images_group_mode", wxChoice);
714 size_t sel=group->GetSelection();
719 group->Append(_(
"None"), i);
722 group->Append(_(
"Lens"), i);
727 group->Append(_(
"Stacks"), i);
732 group->Append(_(
"Output layers"), i);
735 group->Append(_(
"Output stacks"), i);
742 group->SetSelection(sel);
743 wxCommandEvent dummy;
753 m_optChoice->Append(_(
"Positions (incremental, starting from anchor)"), i);
759 m_optChoice->Append(_(
"Positions and View (y,p,r,v)"), i);
762 m_optChoice->Append(_(
"Positions and Barrel Distortion (y,p,r,b)"), i);
765 m_optChoice->Append(_(
"Positions, View and Barrel (y,p,r,v,b)"), i);
770 m_optChoice->Append(_(
"Everything without translation"), i);
780 m_optChoice->Append(_(
"Positions and Translation (y,p,r,x,y,z)"), i);
783 m_optChoice->Append(_(
"Positions, Translation and View (y,p,r,x,y,z,v)"), i);
786 m_optChoice->Append(_(
"Positions, Translation and Barrel (y,p,r,x,y,z,b)"), i);
789 m_optChoice->Append(_(
"Positions, Translation, View and Barrel (y,p,r,x,y,z,v,b)"), i);
802 m_optPhotoChoice->Append(_(
"Low dynamic range, variable white balance"), i);
810 m_optPhotoChoice->Append(_(
"High dynamic range, variable white balance, fixed exposure"), i);
826 wxChoice* group=XRCCTRL(*
this,
"images_group_mode", wxChoice);
841 wxRadioBox* display=XRCCTRL(*
this,
"images_column_radiobox", wxRadioBox);
873 wxStaticText* textlabel=XRCCTRL(*
this,
"images_mode_text", wxStaticText);
877 textlabel->SetLabel(_(
"Simple interface"));
880 textlabel->SetLabel(_(
"Advanced interface"));
883 textlabel->SetLabel(_(
"Expert interface"));
886 textlabel->GetParent()->Layout();
887 textlabel->Refresh();
904 : wxXmlResourceHandler()
913 cp->Create(m_parentAsWindow,
915 GetPosition(), GetSize(),
916 GetStyle(wxT(
"style")),
925 return IsOfClass(node, wxT(
"ImagesPanel"));
void UpdatePreviewImage()
virtual void panoramaImagesChanged(HuginBase::Panorama &pano, const HuginBase::UIntSet &imgNr)
notifies about changes to images
wxTextCtrl * m_focallength
the text input control for focal length
virtual wxObject * DoCreateResource()
void SetGroupMode(GroupMode newMode)
sets the group mode to given mode
wxString GetDataPath()
return path to data directory, it depends on operating system
void Read(wxConfigBase *config=wxConfigBase::Get(), wxString loadFromFile=wxEmptyString)
read the settings of different cp generators from config
virtual HuginBase::CPVector automatch(CPDetectorSetting &setting, HuginBase::Panorama &pano, const HuginBase::UIntSet &imgs, int nFeatures, int &ret_value, wxWindow *parent=NULL)
Do cp matching, calles the right routines, based on the matcher selected.
bool str2double(const wxString &s, double &d)
declaration of main image tree control
bool removeObserver(PanoramaObserver *observer)
remove a panorama observer.
wxStaticBitmap * m_smallImgCtrl
pointer to the preview image control
Somewhere to specify what variables belong to what.
wxChoice * m_CPDetectorChoice
void RunCPGenerator(CPDetectorSetting &setting, const HuginBase::UIntSet &img)
run the cp generator with the given setting on selected images
const cmsHPROFILE GetMonitorProfile() const
returns the monitor profile, if no monitor profile was found the sRGB profile is used instead ...
wxChoice * m_lenstype
pointer to lens type selector
wxString doubleTowxString(double d, int digits)
#define DEBUG_ASSERT(cond)
void OnPhotometricOptimizerSwitchChanged(wxCommandEvent &e)
event handler, when photometric optimizer master switch was changed
void OnPhotometricOptimize(wxCommandEvent &e)
HuginBase::Panorama * m_pano
the model
include file for the hugin project
void ShowImage(unsigned int imgNr)
show a bigger thumbnail
update the photometric optimizer master switch
void OnDisplayModeChanged(wxCommandEvent &e)
event handler when display mode (which information should be shown) was changed
void OnLensTypeChanged(wxCommandEvent &e)
updates the lens type for the selected images
wxBitmap m_empty
bitmap with default image
static huginApp * Get()
hack.. kind of a pseudo singleton...
void Init(HuginBase::Panorama *pano)
initialization, connects all control with Panorama, register observer
PanoCommand to combine other PanoCommands.
ImagesTreeCtrl * m_images_tree
pointer to the main control
void OnOptimizeButton(wxCommandEvent &e)
event handler for geometric optimizer
Base class for control point creators.
std::set< unsigned int > UIntSet
ArraySettings settings
array which stores the different autopano settings
void FillControl(wxControlWithItems *control, bool select_default=false, bool show_default=false)
fills a wxControlWithItems with the available generators
DisplayMode
enumeration for display mode, limits the displayed columns
bool Create(wxWindow *parent, wxWindowID id=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxTAB_TRAVERSAL, const wxString &name=wxT("panel"))
void OnMaxEvDiffChanged(wxCommandEvent &e)
updates the max ev difference
some definitions to work with optimizer master switches
class, which stores all settings of one cp detector
void SetDisplayMode(DisplayMode newMode)
sets the display mode to given mode
void CorrectImage(wxImage &image, const vigra::ImageImportInfo::ICCProfile &iccProfile, const cmsHPROFILE &monitorProfile)
apply color correction to given image using input iccProfile and monitor profile
double outputLayersExposureDiff
void CPGenerate(wxCommandEvent &e)
control point detection event handler
std::size_t getNrOfImages() const
number of images.
static MainFrame * Get()
hack.. kind of a pseudo singleton...
GroupMode
enumeration for grouping mode
update the optimizer master switch
wxTextCtrl * m_maxEv
the text input control for max ev difference
wxImage imageCacheEntry2wxImage(ImageCache::EntryPtr e)
double outputStacksMinOverlap
IMPLEMENT_DYNAMIC_CLASS(wxTreeListHeaderWindow, wxWindow)
void FillGroupChoice()
fills the grouping wxChoice with values depending on GuiLevel
bool HasMonitorProfile() const
return true if we found a suitable monitor profile and could loading it
static GlobalCmdHist & getInstance()
void ShowMaskEditor(size_t imgNr, bool switchToCropMode=false)
opens the mask/crop editor with the given image selected
void Init(HuginBase::Panorama *pano)
void addCommand(PanoCommand *command, bool execute=true)
Adds a command to the history.
wxTextCtrl * m_cropfactor
the text input control for crop factor
static double calcFocalLength(SrcPanoImage::Projection proj, double hfov, double crop, vigra::Size2D imageSize)
calcualte focal length, given crop factor and hfov
void OnSelectionChanged(wxTreeEvent &e)
change displayed variables if the selection has changed.
void OnOptimize(wxCommandEvent &e)
void SetGuiLevel(GuiLevel newSetting)
sets the GuiLevel of the control
void ReloadCPDetectorSettings()
Reloads the cp detector settings from config, necessary after edit preferences.
wxTextCtrl * m_overlap
the text input control for minimum overlap
void OnMinimumOverlapChanged(wxCommandEvent &e)
updates the minimum overlap
void OnCropFactorChanged(wxCommandEvent &e)
updates the crop factor for the selected images
void OnOptimizerSwitchChanged(wxCommandEvent &e)
event handler, when optimizer master switch was changed
void OnPhotometricOptimizeButton(wxCommandEvent &e)
event handler for photometric optimizer
HuginBase::UIntSet GetSelectedImages()
returns the selected images
void addObserver(PanoramaObserver *o)
add a panorama observer.
include file for the hugin project
const PanoramaOptions & getOptions() const
returns the options for this panorama
HuginBase::ImageCache::RequestPtr thumbnail_request
Request for thumbnail image.
Handle EVT_KILL_FOCUS and convert it to a EVT_TEXT_ENTER event.
wxChoice * m_optPhotoChoice
pointer to photometric optimizer switch selector
the main images tree control, used on images and optimizer tabs
const int getPhotometricOptimizerSwitch() const
return the photometric optimizer master switch
const int getOptimizerSwitch() const
returns optimizer master switch
CPDetectorConfig cpdetector_config
void OnFocalLengthChanged(wxCommandEvent &e)
updates the focal length for the selected images
void OnGroupModeChanged(wxCommandEvent &e)
event handler when grouping selection was changed
std::vector< ControlPoint > CPVector
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
wxString GetCurrentOptimizerString()
return the currently selected optimizer setting as string from the drop down list box ...
wxButton * m_matchingButton
const SrcPanoImage & getImage(std::size_t nr) const
get a panorama image, counting starts with 0
void fill_set(_Container &c, typename _Container::key_type begin, typename _Container::key_type end)
void Write(wxConfigBase *config=wxConfigBase::Get())
writes the settings of different cp generators to config
virtual void panoramaChanged(HuginBase::Panorama &pano)
this is called whenever the panorama has changed.
void OnSize(wxSizeEvent &e)
#define HUGIN_ASS_NCONTROLPOINTS
add multiple control points
wxChoice * m_optChoice
pointer to optimizer switch selector
void SetGuiLevel(GuiLevel newGuiLevel)
sets the GuiLevel for all controls on this panel
All variables of a source image.
const wxString GetSelectedCPGenerator()
return the currently selected cp generator description
void FillOptimizerChoice()
fills the optmizer wxChoices with values depending on GuiLevel
virtual bool CanHandle(wxXmlNode *node)
void DeleteClientData(wxChoice *cb)