28 #include "hugin_config.h"
63 long style,
const wxString& name)
65 if (! wxPanel::Create(parent,
id, pos, size, style, name)) {
69 wxXmlResource::Get()->LoadPanel(
this, wxT(
"images_panel"));
70 wxPanel * panel = XRCCTRL(*
this,
"images_panel", wxPanel);
71 wxBoxSizer *topsizer =
new wxBoxSizer( wxVERTICAL );
72 topsizer->Add(panel, 1, wxEXPAND, 0);
88 m_smallImgCtrl = XRCCTRL(*
this,
"images_selected_image", wxStaticBitmap);
93 wxImage image(1, 1,
true);
94 const wxColour imageBackgroundColor =
m_smallImgCtrl->GetBackgroundColour();
95 image.SetRGB(0, 0, imageBackgroundColor.Red(), imageBackgroundColor.Green(), imageBackgroundColor.Blue());
99 m_lenstype = XRCCTRL(*
this,
"images_lens_type", wxChoice);
105 m_focallength = XRCCTRL(*
this,
"images_focal_length", wxTextCtrl);
110 m_cropfactor = XRCCTRL(*
this,
"images_crop_factor", wxTextCtrl);
115 m_overlap = XRCCTRL(*
this,
"images_overlap", wxTextCtrl);
120 m_maxEv = XRCCTRL(*
this,
"images_maxev", wxTextCtrl);
129 m_optChoice = XRCCTRL(*
this,
"images_optimize_mode", wxChoice);
143 wxConfigBase* config=wxConfigBase::Get();
144 m_degDigits = config->Read(wxT(
"/General/DegreeFractionalDigitsEdit"),3);
172 if(cb->HasClientUntypedData())
174 for(
size_t i = 0; i < cb->GetCount(); i++)
176 delete static_cast<int*
>(cb->GetClientData(i));
187 m_maxEv->PopEventHandler(
true);
202 int winWidth, winHeight;
203 GetClientSize(&winWidth, &winHeight);
204 DEBUG_INFO(
"image panel: " << winWidth <<
"x"<< winHeight );
214 int found=wxNOT_FOUND;
217 if(optSwitch==*static_cast<int*>(
m_optChoice->GetClientData(i)))
223 if(found==wxNOT_FOUND)
245 if(found==wxNOT_FOUND)
266 DEBUG_DEBUG(
"nr of sel Images: " << selected.size());
279 XRCCTRL(*
this,
"images_optimize", wxButton)->Enable(pano.
getNrOfImages()>0);
280 XRCCTRL(*
this,
"images_photo_optimize", wxButton)->Enable(pano.
getNrOfImages()>1);
291 if ((selImg.empty()) || (selImg.size() == 1 && progName.Find(wxT(
"linefind")) == wxNOT_FOUND))
312 wxConfigBase* config=wxConfigBase::Get();
314 if(wxGetKeyState(WXK_COMMAND))
317 nFeatures = wxGetNumberFromUser(
318 _(
"Enter maximal number of control points per image pair"),
319 _(
"Points per Overlap"),
320 _(
"Control point detector option"),
327 config->Write(wxT(
"/MainFrame/nControlPoints"), nFeatures);
337 wxMessageBox(wxString::Format(_(
"Added %lu control points"), (
unsigned long) cps.size()), _(
"Control point detector result"),wxOK|wxICON_INFORMATION,
this);
363 bool identical_projection=
true;
366 img.getCropFactor(),img.getSize());;
367 double cropFactor=img.getCropFactor();
368 for (HuginBase::UIntSet::const_iterator it = sel.begin(); it != sel.end(); ++it)
371 if(proj!=img2.getProjection())
373 identical_projection=
false;
376 img2.getCropFactor(),img2.getSize());
377 if(focallength>0 && fabs(focallength-focallength2)>0.05)
381 if(fabs(cropFactor-img2.getCropFactor())>0.1)
387 if(identical_projection)
457 ImageCache::EntryPtr cacheEntry = ImageCache::getInstance().getSmallImageIfAvailable(
459 if (!cacheEntry.get())
476 double iRatio = img.GetWidth() / (double) img.GetHeight();
482 double sRatio = (double)sz.GetWidth() / sz.GetHeight();
483 if (iRatio > sRatio) {
485 sz.SetHeight((
int) (sz.GetWidth() / iRatio));
488 sz.SetWidth((
int) (sz.GetHeight() * iRatio));
492 sz.IncTo(wxSize(1,1));
493 wxImageResizeQuality resizeQuality = wxIMAGE_QUALITY_NORMAL;
494 if (
std::max(img.GetWidth(), img.GetHeight()) > (ULONG_MAX >> 16))
500 resizeQuality = wxIMAGE_QUALITY_BOX_AVERAGE;
502 wxImage scaled = img.Scale(sz.GetWidth(),sz.GetHeight(), resizeQuality);
508 wxBitmap scaledBitmap(scaled);
534 std::vector<PanoCommand::PanoCommand*> commands;
541 if (wxConfig::Get()->Read(wxT(
"/ShowFisheyeCropHint"), 1l) == 1 &&
549 wxXmlResource::Get()->LoadDialog(&dlg, NULL, wxT(
"fisheye_show_crop_dlg"));
550 if (dlg.ShowModal() == wxID_OK)
554 if (XRCCTRL(dlg,
"fisheye_crop_dont_ask_checkbox", wxCheckBox)->IsChecked())
556 wxConfig::Get()->Write(wxT(
"/ShowFisheyeCropHint"), 0l);
590 double hfov=srcImg.
calcHFOV(srcImg.getProjection(), val, srcImg.getCropFactor(), srcImg.getSize());
594 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),
600 wxICON_EXCLAMATION | wxYES_NO)==wxNO)
655 if(fabs(val)<0.001 || val>1)
657 wxMessageBox(_(
"The minimum overlap has to be greater than 0 and smaller than 1."),
663 wxOK | wxICON_INFORMATION,
this);
679 wxString text =
m_maxEv->GetValue();
691 wxMessageBox(_(
"The maximum Ev difference has to be greater than 0."),
697 wxOK | wxICON_INFORMATION,
this);
738 wxCommandEvent dummy;
748 m_optChoice->Append(_(
"Positions (incremental, starting from anchor)"), i);
754 m_optChoice->Append(_(
"Positions and View (y,p,r,v)"), i);
757 m_optChoice->Append(_(
"Positions and Barrel Distortion (y,p,r,b)"), i);
760 m_optChoice->Append(_(
"Positions, View and Barrel (y,p,r,v,b)"), i);
765 m_optChoice->Append(_(
"Everything without translation"), i);
775 m_optChoice->Append(_(
"Positions and Translation (y,p,r,x,y,z)"), i);
778 m_optChoice->Append(_(
"Positions, Translation and View (y,p,r,x,y,z,v)"), i);
781 m_optChoice->Append(_(
"Positions, Translation and Barrel (y,p,r,x,y,z,b)"), i);
784 m_optChoice->Append(_(
"Positions, Translation, View and Barrel (y,p,r,x,y,z,v,b)"), i);
797 m_optPhotoChoice->Append(_(
"Low dynamic range, variable white balance"), i);
805 m_optPhotoChoice->Append(_(
"High dynamic range, variable white balance, fixed exposure"), i);
835 wxRadioBox* display=XRCCTRL(*
this,
"images_column_radiobox", wxRadioBox);
867 wxStaticText* textlabel=XRCCTRL(*
this,
"images_mode_text", wxStaticText);
871 textlabel->SetLabel(_(
"Simple interface"));
874 textlabel->SetLabel(_(
"Advanced interface"));
877 textlabel->SetLabel(_(
"Expert interface"));
880 textlabel->GetParent()->Layout();
881 textlabel->Refresh();
898 : wxXmlResourceHandler()
907 cp->Create(m_parentAsWindow,
909 GetPosition(), GetSize(),
910 GetStyle(wxT(
"style")),
919 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)
wxChoice * m_groupModeChoice
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)