30 #include "hugin_config.h"
32 #if !defined HAVE_EPOXY || !HAVE_EPOXY
38 #include <wx/msgdlg.h>
71 #include <pano13/queryfeature.h>
94 #include <wx/progdlg.h>
95 #include <wx/infobar.h>
130 EVT_CLOSE(GLPreviewFrame::OnClose)
131 EVT_SHOW(GLPreviewFrame::OnShowEvent)
135 EVT_BUTTON(XRCID("preview_center_tool"), GLPreviewFrame::OnCenterHorizontally)
136 EVT_BUTTON(XRCID("preview_fit_pano_tool"), GLPreviewFrame::OnFitPano)
137 EVT_BUTTON(XRCID("preview_fit_pano_tool2"), GLPreviewFrame::OnFitPano)
138 EVT_BUTTON(XRCID("preview_straighten_pano_tool"), GLPreviewFrame::OnStraighten)
139 EVT_BUTTON(XRCID("apply_num_transform"), GLPreviewFrame::OnNumTransform)
140 EVT_TEXT_ENTER(XRCID("input_yaw"), GLPreviewFrame::OnNumTransform)
141 EVT_TEXT_ENTER(XRCID("input_pitch"), GLPreviewFrame::OnNumTransform)
142 EVT_TEXT_ENTER(XRCID("input_roll"), GLPreviewFrame::OnNumTransform)
143 EVT_TEXT_ENTER(XRCID("input_x"), GLPreviewFrame::OnNumTransform)
144 EVT_TEXT_ENTER(XRCID("input_y"), GLPreviewFrame::OnNumTransform)
145 EVT_TEXT_ENTER(XRCID("input_z"), GLPreviewFrame::OnNumTransform)
148 EVT_CHECKBOX(XRCID("preview_photometric_tool"), GLPreviewFrame::OnPhotometric)
149 EVT_TOGGLEBUTTON(XRCID("preview_identify_toggle_button"), GLPreviewFrame::OnIdentify)
150 EVT_TOGGLEBUTTON(XRCID("preview_color_picker_toggle_button"), GLPreviewFrame::OnColorPicker)
151 EVT_TOGGLEBUTTON(XRCID("preview_edit_cp_toggle_button"), GLPreviewFrame::OnEditCPTool)
152 EVT_CHECKBOX(XRCID("preview_control_point_tool"), GLPreviewFrame::OnControlPoint)
153 EVT_BUTTON(XRCID("preview_autocrop_tool"), GLPreviewFrame::OnAutocrop)
154 EVT_BUTTON(XRCID("preview_stack_autocrop_tool"), GLPreviewFrame::OnStackAutocrop)
155 EVT_BUTTON(XRCID("preview_autocrop_outside_tool"), GLPreviewFrame::OnAutocropOutside)
156 EVT_NOTEBOOK_PAGE_CHANGED(XRCID("mode_toolbar_notebook"), GLPreviewFrame::OnSelectMode)
157 EVT_NOTEBOOK_PAGE_CHANGING(XRCID("mode_toolbar_notebook"), GLPreviewFrame::OnToolModeChanging)
158 EVT_BUTTON(
ID_HIDE_HINTS, GLPreviewFrame::OnHideProjectionHints)
159 EVT_BUTTON(XRCID("exposure_default_button"), GLPreviewFrame::OnDefaultExposure)
160 EVT_SPIN_DOWN(XRCID("exposure_spin"), GLPreviewFrame::OnDecreaseExposure)
161 EVT_SPIN_UP(XRCID("exposure_spin"), GLPreviewFrame::OnIncreaseExposure)
162 EVT_SPIN_DOWN(XRCID("range_compression_spin"), GLPreviewFrame::OnRangeCompressionDecrease)
163 EVT_SPIN_UP(XRCID("range_compression_spin"), GLPreviewFrame::OnRangeCompressionIncrease)
164 EVT_TEXT_ENTER(XRCID("range_compression_text"), GLPreviewFrame::OnRangeCompressionChanged)
165 EVT_CHOICE(XRCID("blend_mode_choice"), GLPreviewFrame::OnBlendChoice)
166 EVT_CHOICE(XRCID("drag_mode_choice"), GLPreviewFrame::OnDragChoice)
167 EVT_CHOICE(XRCID("projection_choice"), GLPreviewFrame::OnProjectionChoice)
168 EVT_CHOICE(XRCID("overview_mode_choice"), GLPreviewFrame::OnOverviewModeChoice)
169 EVT_CHOICE(XRCID("preview_guide_choice_crop"), GLPreviewFrame::OnGuideChanged)
170 EVT_CHOICE(XRCID("preview_guide_choice_drag"), GLPreviewFrame::OnGuideChanged)
171 EVT_CHOICE(XRCID("preview_guide_choice_proj"), GLPreviewFrame::OnGuideChanged)
172 EVT_MENU(XRCID("action_show_overview"), GLPreviewFrame::OnOverviewToggle)
173 EVT_MENU(XRCID("action_show_grid"), GLPreviewFrame::OnSwitchPreviewGrid)
176 EVT_MENU_CLOSE(GLPreviewFrame::OnMenuClose)
179 EVT_SCROLL_CHANGED(GLPreviewFrame::OnChangeFOV)
180 EVT_COMMAND_SCROLL_CHANGED(XRCID("layout_scale_slider"), GLPreviewFrame::OnLayoutScaleChange)
183 EVT_COMMAND_SCROLL(XRCID("layout_scale_slider"), GLPreviewFrame::OnLayoutScaleChange)
184 EVT_SCROLL_CHANGED(GLPreviewFrame::OnChangeFOV)
185 EVT_COMMAND_SCROLL_THUMBTRACK(XRCID("layout_scale_slider"), GLPreviewFrame::OnLayoutScaleChange)
188 EVT_TEXT_ENTER(XRCID("pano_text_hfov"), GLPreviewFrame::OnHFOVChanged )
189 EVT_TEXT_ENTER(XRCID("pano_text_vfov"), GLPreviewFrame::OnVFOVChanged )
190 EVT_TEXT_ENTER(XRCID("pano_val_roi_left"), GLPreviewFrame::OnROIChanged)
191 EVT_TEXT_ENTER(XRCID("pano_val_roi_top"), GLPreviewFrame::OnROIChanged)
192 EVT_TEXT_ENTER(XRCID("pano_val_roi_right"), GLPreviewFrame::OnROIChanged)
193 EVT_TEXT_ENTER(XRCID("pano_val_roi_bottom"), GLPreviewFrame::OnROIChanged)
194 EVT_BUTTON(XRCID("reset_crop_button"), GLPreviewFrame::OnResetCrop)
195 EVT_BUTTON(XRCID("crop_aspect_button"), GLPreviewFrame::OnSetCropAspect)
196 EVT_TEXT_ENTER(XRCID("exposure_text"), GLPreviewFrame::OnExposureChanged)
197 EVT_COMMAND_RANGE(
PROJ_PARAM_VAL_ID,PROJ_PARAM_VAL_ID+PANO_PROJECTION_MAX_PARMS,wxEVT_COMMAND_TEXT_ENTER,GLPreviewFrame::OnProjParameterChanged)
200 EVT_COLOURPICKER_CHANGED(XRCID("preview_background"), GLPreviewFrame::OnPreviewBackgroundColorChanged)
201 EVT_MENU(XRCID("ID_SHOW_FULL_SCREEN_PREVIEW"), GLPreviewFrame::OnFullScreen)
202 EVT_MENU(XRCID("action_show_main_frame"), GLPreviewFrame::OnShowMainFrame)
203 EVT_MENU(XRCID("action_exit_preview"), GLPreviewFrame::OnUserExit)
204 EVT_BUTTON ( XRCID("ass_load_images_button"), GLPreviewFrame::OnLoadImages)
205 EVT_BUTTON ( XRCID("ass_align_button"), GLPreviewFrame::OnAlign)
206 EVT_BUTTON ( XRCID("ass_create_button"), GLPreviewFrame::OnCreate)
208 EVT_MENU(XRCID("selectMenu_selectAll"), GLPreviewFrame::OnSelectAllMenu)
209 EVT_MENU(XRCID("selectMenu_selectMedian"), GLPreviewFrame::OnSelectMedianMenu)
210 EVT_MENU(XRCID("selectMenu_selectBrightest"), GLPreviewFrame::OnSelectDarkestMenu)
211 EVT_MENU(XRCID("selectMenu_selectDarkest"), GLPreviewFrame::OnSelectBrightestMenu)
212 EVT_MENU(XRCID("selectMenu_keepCurrentSelection"), GLPreviewFrame::OnSelectKeepSelection)
213 EVT_MENU(XRCID("selectMenu_resetSelection"), GLPreviewFrame::OnSelectResetSelection)
217 EVT_ENTER_WINDOW(ImageToogleButtonEventHandler::OnEnter)
218 EVT_LEAVE_WINDOW(ImageToogleButtonEventHandler::OnLeave)
219 EVT_TOGGLEBUTTON(-1, ImageToogleButtonEventHandler::OnChange)
223 EVT_ENTER_WINDOW(ImageGroupButtonEventHandler::OnEnter)
224 EVT_LEAVE_WINDOW(ImageGroupButtonEventHandler::OnLeave)
225 EVT_CHECKBOX(-1, ImageGroupButtonEventHandler::OnChange)
228 #define PF_STYLE (wxMAXIMIZE_BOX | wxMINIMIZE_BOX | wxRESIZE_BORDER | wxSYSTEM_MENU | wxCAPTION | wxCLOSE_BOX | wxCLIP_CHILDREN)
241 GLPreviewFrame * frame = ((
GLwxAuiManager*) GetOwnerManager())->getPreviewFrame();
249 GLPreviewFrame * frame = ((
GLwxAuiManager*) GetOwnerManager())->getPreviewFrame();
251 wxAuiFloatingFrame::OnMoveFinished();
264 wxSizeEvent
event = wxSizeEvent(wxSize());
271 : wxFrame(frame,-1, _(
"Fast Panorama preview"), wxDefaultPosition, wxDefaultSize,
305 int widths[3] = {-3, 150, 150};
306 SetStatusWidths(3, widths);
307 SetStatusText(wxT(
""),1);
308 SetStatusText(wxT(
""),2);
309 wxConfigBase * cfg = wxConfigBase::Get();
311 wxPanel *tool_panel = wxXmlResource::Get()->LoadPanel(
this,wxT(
"mode_panel"));
312 XRCCTRL(*
this,
"preview_center_tool",wxButton)->SetBitmapMargins(0,5);
313 XRCCTRL(*
this,
"preview_fit_pano_tool",wxButton)->SetBitmapMargins(0,5);
314 XRCCTRL(*
this,
"preview_straighten_pano_tool",wxButton)->SetBitmapMargins(0,5);
315 XRCCTRL(*
this,
"preview_fit_pano_tool2",wxButton)->SetBitmapMargins(0,5);
316 XRCCTRL(*
this,
"preview_autocrop_tool",wxButton)->SetBitmapMargins(0,5);
317 XRCCTRL(*
this,
"preview_stack_autocrop_tool",wxButton)->SetBitmapMargins(0,5);
318 XRCCTRL(*
this,
"preview_autocrop_outside_tool", wxButton)->SetBitmapMargins(0, 5);
328 #if !wxCHECK_VERSION(3,1,1)
329 bitmap.LoadFile(
huginApp::Get()->GetXRCPath() + wxT(
"data/identify_tool.png"), wxBITMAP_TYPE_PNG);
331 bitmap.LoadFile(
huginApp::Get()->GetXRCPath() + wxT(
"data/preview_white_balance.png"), wxBITMAP_TYPE_PNG);
333 bitmap.LoadFile(
huginApp::Get()->GetXRCPath() + wxT(
"data/preview_control_point_tool.png"), wxBITMAP_TYPE_PNG);
339 wxApp::s_macExitMenuItemId = XRCID(
"action_exit_preview");
341 wxMenuBar* simpleMenu=wxXmlResource::Get()->LoadMenuBar(
this, wxT(
"preview_simple_menu"));
343 m_filemenuAdvanced = wxXmlResource::Get()->LoadMenu(wxT(
"preview_file_menu_advanced"));
348 SetMenuBar(simpleMenu);
354 XRCCTRL(*
this,
"preview_background", wxColourPickerCtrl)->Refresh();
355 XRCCTRL(*
this,
"preview_background", wxColourPickerCtrl)->Update();
359 wxPanel * toggle_panel =
new wxPanel(
this);
361 bool overview_hidden;
362 cfg->Read(wxT(
"/GLPreviewFrame/overview_hidden"), &overview_hidden,
false);
363 GetMenuBar()->FindItem(XRCID(
"action_show_overview"))->Check(!overview_hidden);
366 new wxStaticBox(toggle_panel, -1, _(
"displayed images")),
370 m_ButtonPanel =
new wxScrolledWindow(toggle_panel, -1, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL);
377 wxPanel *panel =
new wxPanel(toggle_panel);
378 bitmap.LoadFile(
huginApp::Get()->GetXRCPath()+wxT(
"data/preview_show_all.png"),wxBITMAP_TYPE_PNG);
384 long mode = cfg->Read(wxT(
"/GLPreviewFrame/SelectAllMode"), 0l);
411 bitmap.LoadFile(
huginApp::Get()->GetXRCPath()+wxT(
"data/preview_show_none.png"),wxBITMAP_TYPE_PNG);
412 wxButton* select_none =
new wxButton(panel, ID_SHOW_NONE, _(
"None"));
413 select_none->SetBitmap(bitmap,wxLEFT);
414 select_none->SetBitmapMargins(5,0);
416 wxBoxSizer *sizer =
new wxBoxSizer(wxHORIZONTAL);
417 sizer->Add(
m_selectAllButton,0,wxALIGN_CENTER_VERTICAL | wxLEFT | wxTOP | wxBOTTOM,5);
418 sizer->Add(select_none,0,wxALIGN_CENTER_VERTICAL | wxRIGHT | wxTOP | wxBOTTOM,5);
419 panel->SetSizer(sizer);
423 m_topsizer->Add(tool_panel, 0, wxEXPAND | wxALL, 2);
424 m_topsizer->Add(toggle_panel, 0, wxEXPAND | wxBOTTOM, 5);
427 m_infoBar->AddButton(ID_HIDE_HINTS,_(
"Hide"));
432 wxPanel * vis_panel =
new wxPanel(
this);
434 wxPanel * preview_panel =
new wxPanel(vis_panel);
435 wxPanel * overview_panel =
new wxPanel(vis_panel);
438 int args[] = {WX_GL_RGBA, WX_GL_DOUBLEBUFFER, 0};
446 overview_hidden=
false;
452 m_mgr->SetManagedWindow(vis_panel);
453 vis_panel->SetMinSize(wxSize(200,150));
456 wxFlexGridSizer * flexSizer =
new wxFlexGridSizer(2,0,5,5);
457 flexSizer->AddGrowableCol(0);
458 flexSizer->AddGrowableRow(0);
461 wxBoxSizer * overview_sizer =
new wxBoxSizer(wxVERTICAL);
472 wxDefaultPosition, wxDefaultSize,
473 wxSL_VERTICAL | wxSL_AUTOTICKS,
479 m_VFOVSlider->SetToolTip(_(
"drag to change the vertical field of view"));
485 wxDefaultPosition, wxDefaultSize,
486 wxSL_HORIZONTAL | wxSL_AUTOTICKS,
493 m_HFOVSlider->SetToolTip(_(
"drag to change the horizontal field of view"));
495 m_HFOVText = XRCCTRL(*
this,
"pano_text_hfov" ,wxTextCtrl);
498 m_VFOVText = XRCCTRL(*
this,
"pano_text_vfov" ,wxTextCtrl);
502 m_ROILeftTxt = XRCCTRL(*
this,
"pano_val_roi_left", wxTextCtrl);
506 m_ROIRightTxt = XRCCTRL(*
this,
"pano_val_roi_right", wxTextCtrl);
510 m_ROITopTxt = XRCCTRL(*
this,
"pano_val_roi_top", wxTextCtrl);
514 m_ROIBottomTxt = XRCCTRL(*
this,
"pano_val_roi_bottom", wxTextCtrl);
521 int guide=cfg->Read(wxT(
"/GLPreviewFrame/guide"),0l);
530 #if wxCHECK_VERSION(3,1,0)
541 cfg->Read(wxT(
"/GLPreviewFrame/showPreviewGrid"),&showGrid,
true);
542 GetMenuBar()->FindItem(XRCID(
"action_show_grid"))->Check(showGrid);
544 preview_panel->SetSizer(flexSizer);
545 overview_panel->SetSizer(overview_sizer);
547 m_mgr->AddPane(preview_panel,
549 ).Name(wxT(
"preview")
552 ).CaptionVisible(
false
553 ).Caption(_(
"Preview")
560 m_mgr->AddPane(overview_panel,
562 ).Name(wxT(
"overview")
566 ).Caption(_(
"Overview")
567 ).FloatingSize(100,100
568 ).FloatingPosition(500,500
572 ).Show(!overview_hidden
588 for (
auto& lensType : lensInfoVector)
591 const int lensId = lensType.id;
592 Bind(wxEVT_MENU, [
this, lensId](wxCommandEvent&) {
LoadImages(lensId); }, lensTypeId);
625 int nP = panoProjectionFormatCount();
626 for(
int n=0; n < nP; n++) {
627 pano_projection_features proj;
628 if (panoProjectionFeaturesQuery(n, &proj)) {
629 wxString str2(proj.name, wxConvLocal);
648 cfg->Read(wxT(
"/GLPreviewFrame/individualDragMode"), &individualDrag,
false);
703 wxBitmapButton * resetProjButton=
new wxBitmapButton(
m_projection_panel, PROJ_PARAM_RESET_ID,
704 wxArtProvider::GetBitmap(wxART_REDO));
705 resetProjButton->SetToolTip(_(
"Resets the projection's parameters to their default values."));
706 m_projParamSizer->Add(resetProjButton, 0, wxLEFT | wxRIGHT | wxALIGN_CENTER_VERTICAL, 5);
712 for (
int i=0; i < PANO_PROJECTION_MAX_PARMS; i++) {
714 wxBoxSizer* paramBoxSizer =
new wxBoxSizer(wxVERTICAL);
721 wxDefaultPosition, wxSize(35,-1), wxTE_PROCESS_ENTER);
732 wxLEFT | wxRIGHT | wxALIGN_CENTER_VERTICAL ,
747 wxIconBundle myIcons(
huginApp::Get()->GetXRCPath() + wxT(
"data/hugin.ico"),wxBITMAP_TYPE_ICO);
750 wxIcon myIcon(
huginApp::Get()->GetXRCPath() + wxT(
"data/hugin.png"),wxBITMAP_TYPE_PNG);
760 this->SetBackgroundColour(
m_GLPreview->GetBackgroundColour());
764 m_degDigits = wxConfigBase::Get()->Read(wxT(
"/General/DegreeFractionalDigitsEdit"),3);
769 if (cfg->Read(wxT(
"/GLPreviewFrame/isShown"), 0l) != 0)
771 #if defined __WXMSW__ || defined __WXMAC__
780 #if defined __WXMAC__
795 wxString OpenGLLayout=wxConfig::Get()->Read(wxT(
"/GLPreviewFrame/OpenGLLayout"));
796 if(!OpenGLLayout.IsEmpty())
798 m_mgr->LoadPerspective(OpenGLLayout,
true);
800 if(!GetMenuBar()->FindItem(XRCID(
"action_show_overview"))->IsChecked())
802 wxAuiPaneInfo &inf =
m_mgr->GetPane(wxT(
"overview"));
820 wxConfigBase * cfg = wxConfigBase::Get();
824 if ( (!this->IsIconized()) && (! this->IsMaximized()) && this->IsShown()) {
825 cfg->Write(wxT(
"/GLPreviewFrame/isShown"), 1l);
827 cfg->Write(wxT(
"/GLPreviewFrame/isShown"), 0l);
831 cfg->Write(wxT(
"/GLPreviewFrame/OpenGLLayout"),
m_mgr->SavePerspective());
832 cfg->Write(wxT(
"/GLPreviewFrame/overview_hidden"), !(GetMenuBar()->FindItem(XRCID(
"action_show_overview"))->IsChecked()));
833 cfg->Write(wxT(
"/GLPreviewFrame/showPreviewGrid"), GetMenuBar()->FindItem(XRCID(
"action_show_grid"))->IsChecked());
891 for (
int i=0; i < PANO_PROJECTION_MAX_PARMS; i++)
1008 if (opts.
getROI().area() > 0)
1011 wxString labelAspectRatio;
1014 labelAspectRatio = wxString::Format(
"%d:%d", opts.
getROI().width() / commonDivisor, opts.
getROI().height() / commonDivisor);
1018 const float ratio = 1.0f * opts.
getROI().width() / opts.
getROI().height();
1021 labelAspectRatio=wxString::Format(
"%.2f:1", ratio);
1025 labelAspectRatio=wxString::Format(
"1:%.2f", 1.0f / ratio);
1028 XRCCTRL(*
this,
"crop_aspect_label", wxStaticText)->SetLabel(labelAspectRatio);
1040 XRCCTRL(*
this,
"ass_status_text", wxStaticText)->
SetLabel(_(
"No images loaded."));
1044 bool enableCreate =
false;
1049 if (img.getYaw() != 0.0 || img.getPitch() != 0.0 || img.getRoll() != 0.0)
1051 enableCreate =
true;
1057 if (lastCmd ==
"add images" || lastCmd ==
"add and distribute images")
1059 enableCreate =
false;
1066 enableCreate =
true;
1070 enableCreate =
true;
1074 enableCreate =
true;
1085 wxString alignMsg = wxString::Format(_(
"%lu images are connected by %lu control points.\n"), (
unsigned long int) pano.
getNrOfImages(), (
unsigned long int) pano.
getCtrlPoints().size());
1092 if (comps.size() > 1)
1094 alignMsg += wxString::Format(_(
"%lu unconnected image groups found: %s\n"), static_cast<unsigned long int>(comps.size()),
Components2Str(comps).c_str());
1100 alignMsg += _(
"Images or control points have changed, new alignment is needed.");
1111 alignMsg = alignMsg + wxString::Format(_(
"Mean error after optimization: %.1f pixel, max: %.1f"), mean, max);
1116 wxStaticText* statusCtrl = XRCCTRL(*
this,
"ass_status_text", wxStaticText);
1117 statusCtrl->SetLabel(alignMsg);
1118 statusCtrl->InvalidateBestSize();
1126 XRCCTRL(*
this,
"ass_status_text", wxStaticText)->SetLabel(_(
"One image loaded."));
1137 wxString projection;
1163 bool relayout =
false;
1171 for (i=0; i < nParam; i++) {
1172 const pano_projection_parameter * pp = & (opts.
m_projFeatures.parm[i]);
1173 wxString str2(pp->name, wxConvLocal);
1174 str2 = wxGetTranslation(str2);
1178 for(;i < PANO_PROJECTION_MAX_PARMS; i++) {
1192 assert((
int) params.size() == nParam);
1193 for (
int i=0; i < nParam; i++) {
1203 SetStatusText(wxString::Format(wxT(
"%.1f x %.1f"), opts.
getHFOV(), opts.
getVFOV()),2);
1208 m_HFOVText->ChangeValue(wxString(val.c_str(), wxConvLocal));
1210 m_VFOVText->ChangeValue(wxString(val.c_str(), wxConvLocal));
1215 XRCCTRL(*
this,
"preview_autocrop_tool",wxButton)->Enable(activeImgs);
1216 XRCCTRL(*
this,
"preview_stack_autocrop_tool",wxButton)->Enable(activeImgs);
1235 GetMenuBar()->Enable(XRCID(
"action_optimize"), nrImages > 0);
1240 for (
int i=nrButtons-1; i>=(int)nrImages; i--)
1283 if ( nrImages >= nrButtons ) {
1284 for(HuginBase::UIntSet::const_iterator it = changed.begin(); it != changed.end(); ++it){
1285 if (*it >= nrButtons) {
1291 wxBoxSizer * siz =
new wxBoxSizer(wxVERTICAL);
1293 wxToggleButton * but =
new wxToggleButton(pan,
1295 wxString::Format(wxT(
" %d "),*it),
1296 wxDefaultPosition, wxDefaultSize,
1299 wxCheckBox *butcheck =
new wxCheckBox(pan, wxID_ANY, wxT(
""));
1301 #if defined __WXMSW__ || defined __WXMAC__
1305 siz->Add(butcheck, 0, wxALIGN_CENTRE_HORIZONTAL | wxFIXED_MINSIZE, 0);
1306 siz->Add(but,0,wxLEFT | wxRIGHT | wxBOTTOM , 5);
1308 siz->Add(but,0,wxALL ,0);
1309 siz->Add(butcheck, 0, wxALL | wxFIXED_MINSIZE, 0);
1319 but->PushEventHandler(event_handler);
1321 ImageGroupButtonEventHandler * group_event_handler =
new
1322 ImageGroupButtonEventHandler(*it,
this, &
m_pano);
1329 butcheck->PushEventHandler(group_event_handler);
1332 but->SetValue(
true);
1347 for (
unsigned i=0; i < nrImages; i++) {
1391 bool toggle_on = GetMenuBar()->FindItem(XRCID(
"action_show_overview"))->IsChecked();
1392 wxAuiPaneInfo &inf =
m_mgr->GetPane(wxT(
"overview"));
1395 if (!inf.IsShown() && toggle_on ) {
1400 if (inf.IsFloating() && inf.IsShown()) {
1419 if (GetMenuBar()->FindItem(XRCID(
"action_show_overview"))->IsChecked()) {
1439 if (GetMenuBar()->FindItem(XRCID(
"action_show_overview"))->IsChecked()) {
1460 bool toggle_on = GetMenuBar()->FindItem(XRCID(
"action_show_overview"))->IsChecked();
1461 wxAuiPaneInfo &inf =
m_mgr->GetPane(wxT(
"overview"));
1463 if (inf.IsShown() && !toggle_on) {
1467 }
else if (!(inf.IsShown() && toggle_on)) {
1469 #if defined __WXMSW__ || defined __WXMAC__
1482 if(GetMenuBar()->FindItem(XRCID(
"action_show_grid"))->IsChecked())
1504 if (event.CanVeto())
1514 if (event.CanVeto())
1530 void PreviewFrame::OnProjectionChanged()
1536 case PanoramaOptions::RECTILINEAR: Ip = _(
"Rectilinear");
break;
1537 case PanoramaOptions::CYLINDRICAL: Ip = _(
"Cylindrical");
break;
1538 case PanoramaOptions::EQUIRECTANGULAR: Ip = _(
"Equirectangular");
break;
1540 opt.projectionFormat = (PanoramaOptions::ProjectionFormat) lt;
1544 DEBUG_DEBUG (
"Projection changed: " << lt <<
":" << Ip )
1607 for (
size_t i = 0; i < stackedImg.size(); ++i)
1612 displayedImgs.insert(*(stackedImg[i].rbegin()));
1615 displayedImgs.insert(*(stackedImg[i].begin()));
1619 displayedImgs.insert(stackedImg[i][stackedImg[i].size() / 2]);
1659 text = XRCCTRL(*
this,
"input_yaw",wxTextCtrl)->GetValue();
1663 wxMessageBox(_(
"Yaw value must be numeric."),_(
"Warning"),wxOK | wxICON_ERROR,
this);
1666 text = XRCCTRL(*
this,
"input_pitch",wxTextCtrl)->GetValue();
1670 wxMessageBox(_(
"Pitch value must be numeric."),_(
"Warning"),wxOK | wxICON_ERROR,
this);
1673 text = XRCCTRL(*
this,
"input_roll",wxTextCtrl)->GetValue();
1677 wxMessageBox(_(
"Roll value must be numeric."),_(
"Warning"),wxOK | wxICON_ERROR,
this);
1687 text = XRCCTRL(*
this,
"input_x",wxTextCtrl)->GetValue();
1691 wxMessageBox(_(
"X value must be numeric."),_(
"Warning"),wxOK | wxICON_ERROR,
this);
1694 text = XRCCTRL(*
this,
"input_y",wxTextCtrl)->GetValue();
1698 wxMessageBox(_(
"Y value must be numeric."),_(
"Warning"),wxOK | wxICON_ERROR,
this);
1701 text = XRCCTRL(*
this,
"input_z",wxTextCtrl)->GetValue();
1705 wxMessageBox(_(
"Z value must be numeric."),_(
"Warning"),wxOK | wxICON_ERROR,
this);
1720 DEBUG_INFO (
"target exposure = " << text.mb_str(wxConvLocal) );
1722 if (text != wxT(
"")) {
1724 wxLogError(_(
"Value must be numeric."));
1757 if (!text.IsEmpty())
1762 wxLogError(_(
"Value must be numeric."));
1767 wxLogError(_(
"Value for range compression is outside of valid range."));
1786 for (
int i = 0; i < nParam; i++) {
1789 DEBUG_INFO (
"param " << i <<
": = " << text.mb_str(wxConvLocal) );
1791 if (text != wxT(
"")) {
1793 wxLogError(_(
"Value must be numeric."));
1825 DEBUG_DEBUG(
"VFOV changed (slider): " << e.GetInt());
1827 }
else if (e.GetEventObject() == XRCCTRL(*
this,
"layout_scale_slider",wxSlider)) {
1828 DEBUG_DEBUG(
"Layout scale changed (slider): " << e.GetInt());
1833 for (
int i = 0; i < nParam; i++) {
1836 para[i] = e.GetInt();
1859 opt.setVFOV(e.GetInt());
1861 int nParam = opt.m_projFeatures.numberOfParameters;
1862 std::vector<double> para = opt.getProjectionParameters();
1863 for (
int i = 0; i < nParam; i++) {
1866 para[i] = e.GetInt();
1871 opt.setProjectionParameters(para);
1913 if(wxMessageBox(_(
"The mosaic/plane mode works only correct for a remapping plane of yaw=0 and pitch=0.\nBut your project has non-zero Tpy and Tpp parameters.\nShould the Tpy and Tpp parameters reset to zero?"),
1919 wxYES_NO | wxICON_QUESTION,
this) == wxYES)
1953 for (
size_t i = 0 ; i < nr; i++)
1969 for (
size_t i = 0 ; i < nr ; i++)
1972 img.setTranslationPlaneYaw(0);
1973 img.setTranslationPlanePitch(0);
2009 if(wxMessageBox(_(
"The mosaic/plane mode works only correct for a remapping plane of yaw=0 and pitch=0.\nBut your project has non-zero Tpy and Tpp parameters.\nShould the Tpy and Tpp parameters reset to zero?"),
2015 wxYES_NO | wxICON_QUESTION,
this) == wxYES)
2068 bool normalMode=index==0 || index==1;
2069 XRCCTRL(*
this,
"label_yaw",wxStaticText)->Show(normalMode);
2070 XRCCTRL(*
this,
"input_yaw",wxTextCtrl)->Show(normalMode);
2071 XRCCTRL(*
this,
"label_pitch",wxStaticText)->Show(normalMode);
2072 XRCCTRL(*
this,
"input_pitch",wxTextCtrl)->Show(normalMode);
2073 XRCCTRL(*
this,
"label_roll",wxStaticText)->Show(normalMode);
2074 XRCCTRL(*
this,
"input_roll",wxTextCtrl)->Show(normalMode);
2075 XRCCTRL(*
this,
"label_x",wxStaticText)->Show(!normalMode);
2076 XRCCTRL(*
this,
"input_x",wxTextCtrl)->Show(!normalMode);
2077 XRCCTRL(*
this,
"label_y",wxStaticText)->Show(!normalMode);
2078 XRCCTRL(*
this,
"input_y",wxTextCtrl)->Show(!normalMode);
2079 XRCCTRL(*
this,
"label_z",wxStaticText)->Show(!normalMode);
2080 XRCCTRL(*
this,
"input_z",wxTextCtrl)->Show(!normalMode);
2082 XRCCTRL(*
this,
"apply_num_transform",wxButton)->GetParent()->Layout();
2152 SetStatusText(message, 0);
2180 if(GetMenuBar()->FindItem(XRCID(
"action_show_grid"))->IsChecked())
2209 if(GetMenuBar()->FindItem(XRCID(
"action_show_grid"))->IsChecked())
2246 SetStatusText(wxT(
""), 0);
2277 SetStatusText(wxT(
""), 0);
2296 std::set<Tool*>::iterator i;
2297 for (i = tools.begin(); i != tools.end(); ++i)
2315 }
else if (*i == preview_control_point_tool)
2318 XRCCTRL(*
this,
"preview_control_point_tool",wxCheckBox)->SetValue(
false);
2328 unsigned char green,
2333 #if defined __WXMSW__ || defined __WXMAC__
2334 if (red || green || blue)
2348 if (red || green || blue)
2352 m_ToggleButtons[image_nr]->SetBackgroundColour(wxColour(red, green, blue));
2373 for (
unsigned image = 0; image < nr_images; image++)
2375 #if defined __WXMSW__ || defined __WXMAC__
2390 SetStatusText(wxT(
""), 0);
2414 wxCommandEvent e(wxEVT_COMMAND_TOOL_CLICKED, XRCID(
"preview_color_picker_tool"));
2416 GetEventHandler()->AddPendingEvent(e);
2422 SetStatusText(wxT(
""), 0);
2434 if (!XRCCTRL(*
this,
"preview_control_point_tool", wxCheckBox)->GetValue())
2444 unsigned int image_number_in,
2445 wxToggleButton* identify_button_in,
2462 std::vector<PreviewIdentifyTool**>::iterator it;
2478 std::vector<PreviewIdentifyTool**>::iterator it;
2480 (*(*it))->StopShowingImages();
2493 wxMouseEvent null_event;
2494 if (e.IsChecked()) {
2514 : image_number(image_number), frame(frame_in), m_pano(m_pano) {}
2526 std::vector<PreviewIdentifyTool**>::iterator it;
2539 std::vector<PreviewIdentifyTool**>::iterator it;
2541 (*(*it))->StopShowingImages();
2549 wxMouseEvent null_event;
2550 if (e.IsChecked()) {
2578 if (update_check_box) {
2584 if (update_check_box) {
2590 std::vector<wxCheckBox*>::iterator it;
2591 unsigned int nr = 0;
2601 std::vector<wxCheckBox*>::iterator it;
2603 (*it)->SetValue(
false);
2609 std::vector<wxCheckBox*>::iterator it;
2612 (*it)->Show(isShown);
2627 unsigned int oldMode = wxConfigBase::Get()->Read(wxT(
"/GLPreviewFrame/blendMode"), 0l);
2645 vigra::Rect2D newROI;
2657 if(!newROI.isEmpty())
2675 vigra::Rect2D newROI;
2683 if (stackImgs.size()<activeImages.size())
2685 cropPano.setStacks(stackImgs);
2688 if (cropPano.hasRunSuccessfully())
2690 newROI = cropPano.getResultOptimalROI();
2695 if(!newROI.isEmpty())
2713 vigra::Rect2D newROI;
2725 if (!newROI.isEmpty())
2737 ShowFullScreen(!IsFullScreen(), wxFULLSCREEN_NOBORDER | wxFULLSCREEN_NOCAPTION);
2744 SetStatusText(wxT(
""), 0);
2766 XRCCTRL(*
this,
"preview_control_point_tool",wxCheckBox)->SetValue(
false);
2794 std::vector<wxCheckBox*>::iterator it;
2807 wxScrollEvent dummy;
2844 std::vector<wxCheckBox*>::iterator it;
2879 long left, right, top, bottom;
2881 wxLogError(_(
"Top needs to be an integer bigger than 0"));
2885 wxLogError(_(
"left needs to be an integer bigger than 0"));
2889 wxLogError(_(
"right needs to be an integer bigger than 0"));
2893 wxLogError(_(
"bottom needs to be an integer bigger than 0"));
2896 opt.
setROI(vigra::Rect2D(left, top, right, bottom));
2898 if(opt.
getROI().width()<1) {
2899 wxLogError(_(
"left boundary must be smaller than right"));
2904 if(opt.
getROI().height()<1) {
2905 wxLogError(_(
"top boundary must be smaller than bottom"));
2926 if (dlg.ShowModal() == wxID_OK)
2931 int left = opt.
getROI().left();
2932 int top = opt.
getROI().top();
2933 int width = opt.
getROI().width();
2934 int height = opt.
getROI().height();
2935 const int newHeight = 1.0 * width / aspectRatio;
2936 if (newHeight > height)
2938 const int newWidth = 1.0 * height * aspectRatio;
2939 left = left + (width - newWidth) / 2.0;
2944 top = top + (height - newHeight) / 2.0;
2948 opt.
setROI(vigra::Rect2D(left, top, left + width, top + height));
2959 DEBUG_INFO (
"HFOV = " << text.mb_str(wxConvLocal) );
2960 if (text == wxT(
"")) {
2966 wxLogError(_(
"Value must be numeric."));
2971 wxLogError(wxString::Format(
2972 _(
"Invalid HFOV value. Maximum HFOV for this projection is %lf."),
2990 DEBUG_INFO (
"VFOV = " << text.mb_str(wxConvLocal) );
2991 if (text == wxT(
"")) {
2997 wxLogError(_(
"Value must be numeric."));
3002 wxLogError(wxString::Format(
3003 _(
"Invalid VFOV value. Maximum VFOV for this projection is %lf."),
3020 double scale_factor=XRCCTRL(*
this,
"layout_scale_slider",wxSlider)->GetValue();
3033 double maxfov = hfov > vfov ? hfov : vfov;
3036 bool rectilinear_option =
false;
3039 if (maxfov > 120.0) {
3041 message = _(
"With a wide field of view, panoramas with rectilinear projection get very stretched towards the edges.\n");
3043 message += _(
"Since the field of view is only very wide in the horizontal direction, try a cylindrical projection instead.");
3045 message += _(
"For a very wide panorama, try equirectangular projection instead.");
3047 message += wxT(
" ");
3048 message += _(
"You could also try Panini projection.");
3053 message = _(
"With a wide vertical field of view, panoramas with cylindrical projection get very stretched at the top and bottom.\nAn equirectangular projection would fit the same content in less vertical space.");
3054 }
else rectilinear_option =
true;
3057 if (vfov < 110.0 && hfov > 120.0)
3059 message = _(
"Since the vertical field of view is not too wide, you could try setting the panorama projection to cylindrical.\nCylindrical projection preserves vertical lines, unlike equirectangular.");
3060 }
else rectilinear_option =
true;
3063 if (maxfov < 280.0) {
3064 rectilinear_option =
true;
3065 message = _(
"Stereographic projection is conformal, unlike this Fisheye panorama projection.\nA conformal projection preserves angles around a point, which often makes it easier on the eye.");
3069 if (maxfov > 300.0) {
3070 message = _(
"Panoramas with stereographic projection and a very wide field of view stretch the image around the edges a lot.\nThe Fisheye panorama projection compresses it, so you can fit in a wide field of view and still have a reasonable coverage of the middle.");
3071 }
else rectilinear_option =
true;
3074 rectilinear_option =
true;
3076 if (rectilinear_option && maxfov < 110.0) {
3077 message = _(
"Setting the panorama to rectilinear projection would keep the straight lines straight.");
3079 if (message.IsEmpty()) {
3083 m_infoBar->ShowMessage(message, wxICON_INFORMATION);
3098 wxMessageBox(_(
"You have hidden the infobar, which shows hints about selection of projection.\nIf you want to see the bar again, activate the bar in the preferences again."),
3104 wxOK | wxICON_INFORMATION,
this);
3106 wxConfigBase* cfg=wxConfigBase::Get();
3107 cfg->Write(wxT(
"/GLPreviewFrame/ShowProjectionHints"),
false);
3132 wxConfigBase* cfg=wxConfigBase::Get();
3133 cfg->Write(wxT(
"/GLPreviewFrame/PreviewBackground"), c);
3149 int selection=e.GetSelection();
3162 if(old_selection==wxNOT_FOUND)
3187 wxCommandEvent dummy;
3210 wxApp::s_macExitMenuItemId = XRCID(
"action_exit_preview");
3214 GetMenuBar()->Remove(0);
3222 wxApp::s_macExitMenuItemId = XRCID(
"action_exit_hugin");
3226 GetMenuBar()->Remove(0);
3229 SetTitle(_(
"Fast Panorama preview"));
3236 GetMenuBar()->FindItem(XRCID(
"action_gui_simple"))->Check();
3239 GetMenuBar()->FindItem(XRCID(
"action_gui_advanced"))->Check();
3242 GetMenuBar()->FindItem(XRCID(
"action_gui_expert"))->Check();
3284 if (wxConfig::Get()->Read(wxT(
"/ShowFisheyeCropHint"), 1l) == 1)
3288 wxXmlResource::Get()->LoadDialog(&dlg, NULL, wxT(
"fisheye_show_crop_dlg"));
3289 if (dlg.ShowModal() == wxID_OK)
3293 if (XRCCTRL(dlg,
"fisheye_crop_dont_ask_checkbox", wxCheckBox)->IsChecked())
3295 wxConfig::Get()->Write(wxT(
"/ShowFisheyeCropHint"), 0l);
3320 const long autoAlign = wxConfigBase::Get()->Read(wxT(
"/Assistant/autoAlign"),
HUGIN_ASS_AUTO_ALIGN);
3324 wxCommandEvent dummy;
3329 std::vector<PanoCommand::PanoCommand*> cmds;
3330 cmds.push_back(cmd);
3331 if(distributeImages)
3337 combinedCmd->
setName(
"add and distribute images");
3344 HuginBase::FileMetaData::const_iterator pos = metaData.find(
"readProjectionFromDB");
3345 if(!(pos != metaData.end() && pos->second ==
"true"))
3362 if(dlg.ShowModal()==wxID_OK)
3367 wxCommandEvent dummy;
3378 long afterEditCPAction = wxConfig::Get()->Read(wxT(
"/EditCPAfterAction"), 0l);
3380 if (afterEditCPAction == 0)
3383 wxXmlResource::Get()->LoadDialog(&dlg,
this, wxT(
"edit_cp_optimize_dialog"));
3384 XRCCTRL(dlg,
"edit_cp_text1", wxStaticText)->SetLabel(wxString::Format(_(
"%lu control points were removed from the panorama.\n\nShould the panorama now be re-optimized?"), static_cast<unsigned long int>(
edit_cp_tool->
GetFoundCPs().size())));
3385 XRCCTRL(dlg,
"edit_cp_text2", wxStaticText)->SetLabel(wxString::Format(_(
"Current selected optimizer strategy is \"%s\"."),
MainFrame::Get()->GetCurrentOptimizerString().c_str()));
3387 optimize = (dlg.ShowModal() == wxID_OK);
3388 if (XRCCTRL(dlg,
"edit_cp_dont_show_again_checkbox", wxCheckBox)->GetValue())
3392 wxConfig::Get()->Write(wxT(
"/EditCPAfterAction"), 1l);
3396 wxConfig::Get()->Write(wxT(
"/EditCPAfterAction"), 2l);
3402 optimize = (afterEditCPAction == 1);
3407 wxCommandEvent ev(wxEVT_COMMAND_BUTTON_CLICKED, XRCID(
"action_optimize"));
3414 #define MAX_DIMENSION 1600
3435 wxMessageBox(_(
"The selected region contains no active image.\nPlease select a region which is covered by at least 2 images."),
3441 wxOK | wxICON_INFORMATION,
this);
3444 if (imgs.size() < 2)
3446 wxMessageBox(_(
"The selected region is only covered by a single image.\nCan't create control points for a single image."),
3452 wxOK | wxICON_INFORMATION,
this);
3457 if(wxMessageBox(_(
"The selected rectangle is very big.\nThis function is only intended for smaller areas. Otherwise unwanted side effect can appear.\n\nProceed anyway?"),
3463 wxYES_NO | wxICON_INFORMATION,
this) == wxNO)
3486 for (HuginBase::UIntSet::const_iterator it = imgs.begin(); it != imgs.end(); ++it)
3488 const size_t imgNr = *it;
3489 if (!progress.updateDisplayValue(_(
"Remap image to panorama projection...")))
3494 findStruct.
imgNr = imgNr;
3501 srcImg.setExposureValue(0);
3504 if (!progress.updateDisplay())
3512 cpInfos.push_back(findStruct);
3514 if (cpInfos.size() > 1)
3518 unsigned gridx =
hugin_utils::roundi(sqrt((
double)roi.width() / (double)roi.height() * 25));
3528 while (roi.width() / gridx < 20 && gridx > 1)
3532 while (roi.height() / gridy < 20 && gridy > 1)
3537 const long templWidth = 20;
3539 const long sWidth = 100;
3541 for (
size_t img1 = 0; img1 < cpInfos.size() - 1; ++img1)
3543 if (!progress.updateDisplayValue(_(
"Matching interest points...")))
3547 vigra::Size2D size(cpInfos[img1].image.width(), cpInfos[img1].image.height());
3549 std::vector<vigra::Rect2D> rects;
3550 for (
unsigned party = 0; party < gridy; party++)
3552 for (
unsigned partx = 0; partx < gridx; partx++)
3554 vigra::Rect2D rect(partx*size.x / gridx, party*size.y / gridy,
3555 (partx + 1)*size.x / gridx, (party + 1)*size.y / gridy);
3556 rect &= vigra::Rect2D(size);
3557 if (rect.width()>0 && rect.height()>0)
3559 rects.push_back(rect);
3564 if (!progress.updateDisplay())
3569 #pragma omp parallel for schedule(dynamic)
3570 for (
int i = 0; i < rects.size(); ++i)
3573 vigra::Rect2D rect(rects[i]);
3577 MapPoints validPoints;
3578 for (MapPoints::const_iterator it = points.begin(); it != points.end(); ++it)
3580 if (cpInfos[img1].mask(it->second.x, it->second.y)>0)
3582 validPoints.insert(*it);
3586 if (!validPoints.empty())
3589 for (
size_t img2 = img1 + 1; img2 < cpInfos.size(); ++img2)
3593 for (MapPoints::const_reverse_iterator it = validPoints.rbegin(); it != validPoints.rend(); ++it)
3601 if (cpInfos[img2].mask(it->second.x, it->second.y) == 0)
3607 cpInfos[img2].image, vigra::RGBToGrayAccessor<vigra::RGBValue<vigra::UInt8> >(), it->second, sWidth);
3624 cpInfos[img1].image.resize(0, 0);
3625 cpInfos[img1].mask.resize(0, 0);
3629 for (
size_t i = 0; i < tempCps.size(); ++i)
3662 if (!progress.updateDisplayValue(_(
"Checking results...")))
3669 if (!invalidCP.empty())
3671 for (HuginBase::UIntSet::const_reverse_iterator it = invalidCP.rbegin(); it != invalidCP.rend(); ++it)
3673 cps.erase(cps.begin() + *it);
3677 if (!progress.updateDisplayValue())
3683 long afterEditCPAction = wxConfig::Get()->Read(wxT(
"/EditCPAfterAction"), 0l);
3685 if (afterEditCPAction == 0)
3690 wxXmlResource::Get()->LoadDialog(&dlg,
this, wxT(
"edit_cp_optimize_dialog"));
3691 XRCCTRL(dlg,
"edit_cp_text1", wxStaticText)->SetLabel(wxString::Format(_(
"%lu control points were added to the panorama.\n\nShould the panorama now be re-optimized?"), static_cast<unsigned long int>(cps.size())));
3692 XRCCTRL(dlg,
"edit_cp_text2", wxStaticText)->SetLabel(wxString::Format(_(
"Current selected optimizer strategy is \"%s\"."),
MainFrame::Get()->GetCurrentOptimizerString().c_str()));
3694 optimize = (dlg.ShowModal() == wxID_OK);
3695 if (XRCCTRL(dlg,
"edit_cp_dont_show_again_checkbox", wxCheckBox)->GetValue())
3699 wxConfig::Get()->Write(wxT(
"/EditCPAfterAction"), 1l);
3703 wxConfig::Get()->Write(wxT(
"/EditCPAfterAction"), 2l);
3709 optimize = (afterEditCPAction == 1);
3714 wxCommandEvent ev(wxEVT_COMMAND_BUTTON_CLICKED, XRCID(
"action_optimize"));
3734 wxConfig::Get()->Write(wxT(
"/GLPreviewFrame/SelectAllMode"), 0l);
3740 wxConfig::Get()->Write(wxT(
"/GLPreviewFrame/SelectAllMode"), 1l);
3746 wxConfig::Get()->Write(wxT(
"/GLPreviewFrame/SelectAllMode"), 2l);
3752 wxConfig::Get()->Write(wxT(
"/GLPreviewFrame/SelectAllMode"), 3l);
3758 wxConfig::Get()->Write(wxT(
"/GLPreviewFrame/SelectAllKeepSelection"),
true);
3764 wxConfig::Get()->Write(wxT(
"/GLPreviewFrame/SelectAllKeepSelection"),
false);
HuginBase::UIntSet GetDragGroupImages()
AlphaImage m_mask
corresponding alpha channel
Base class for all panorama commands.
wxTextCtrl * m_rangeCompressionTextCtrl
PlaneOverviewCameraTool * plane_overview_camera_tool
SelectAllMode m_selectAllMode
HuginBase::Panorama & m_pano
int gcd(int a, int b)
function to calculate greated common divisor using Euclidean algorithm both arguments should be >=0 ...
PanoramaOptions::ProjectionFormat getProjection() const
#define HUGIN_SHOW_PROJECTION_HINTS
void OnRangeCompressionDecrease(wxSpinEvent &e)
std::vector< UIntSet > getHDRStacks(const PanoramaData &pano, UIntSet allImgs, PanoramaOptions opts)
returns vector of set of output stacks
wxSpinButton * m_exposureSpinBut
update variables of a group of images
declaration of functions to handle stacks and layers
std::vector< wxToggleButton * > m_ToggleButtons
void OnRemoveCP(wxCommandEvent &e)
handler to remove cp
PreviewCropTool * crop_tool
void OnControlPoint(wxCommandEvent &e)
PreviewDifferenceTool * panosphere_difference_tool
double outputRangeCompression
void OnCreate(wxCommandEvent &e)
wxGLContext * GetContext()
PreviewIdentifyTool * identify_tool
void SetStatusMessage(wxString message)
The OpenGL preview frame.
virtual PanoCommand::PanoCommand * GetCommand(wxWindow *parent, HuginBase::Panorama &pano, HuginBase::UIntSet images, GuiLevel guiLevel)
returns the appropriate PanoCommand::PanoCommand to be inserted into GlobalCmdHistory, checks if operation is enabled
void setHeight(unsigned int h)
set panorama height
void OnIdentify(wxCommandEvent &e)
pano_projection_features m_projFeatures
wxChoice * m_DragModeChoice
wxColour GetPreviewBackgroundColor()
void OnShowAll(wxCommandEvent &e)
void StorePositionAndSize()
store position and size of window in wxConfig
#define HUGIN_PREVIEW_BACKGROUND
virtual double getResultMean()
void setPanoImage(const SrcPanoImage &src, const PanoramaOptions &dest, vigra::Rect2D roi)
static double calcMeanExposure(const PanoramaData &pano)
bool str2double(const wxString &s, double &d)
void AddUserDefinedAssistant(int id, const wxString &desc, const wxString &help)
adds the given user defined assistant to SplitButton menu
SrcPanoImage getSrcImage(unsigned imgNr) const
get a description of a source image
PreviewDragTool * drag_tool
GLwxAuiFloatingFrame * CreateFloatingFrame(wxWindow *parent, const wxAuiPaneInfo &p)
std::vector< ImageToogleButtonEventHandler * > toogle_button_event_handlers
PanosphereOverviewCameraTool * panosphere_overview_camera_tool
void OnColorPicker(wxCommandEvent &e)
event handler when starting color picker
center panorama horizontically
void ClearDragGroupImages(bool update_check_box=true)
bool isCircularCrop() const
returns true, if projection requires cicular crop
bool fovCalcSupported(ProjectionFormat f) const
true, if FOV calcuations are supported for projection f
bool removeObserver(PanoramaObserver *observer)
remove a panorama observer.
void ToggleImageInDragGroup(unsigned int image_nr, bool update_check_box=true)
void OnVFOVChanged(wxCommandEvent &e)
virtual void SetLayoutScale(double scale)
wxPanel * m_overviewCommandPanel
void OnOverviewToggle(wxCommandEvent &e)
wxTextCtrl * m_ROIRightTxt
void SetPhotometricCorrect(bool state)
SplitButton * m_createButton
CorrelationResult PointFineTune(const IMAGET &templImg, ACCESSORT access_t, vigra::Diff2D templPos, int templSize, const IMAGES &searchImg, ACCESSORS access_s, vigra::Diff2D searchPos, int sWidth)
fine tune a point with normalized cross correlation
void OnDecreaseExposure(wxSpinEvent &e)
wxBitmapButton * m_defaultExposureBut
void RunAssistant(wxWindow *mainWin, const wxString &userdefinedAssistant=wxEmptyString)
void registerPTWXDlgFcn()
void OnSwitchPreviewGrid(wxCommandEvent &e)
event handler for switch on/off grid on preview
unsigned int getHeight() const
get panorama height
void SetActive(bool active)
UIntSet getImagesinROI(const PanoramaData &pano, const UIntSet activeImages)
returns set of images which are visible in output ROI
void OnShowMainFrame(wxCommandEvent &e)
event handler to show main frame
void Resized(wxSizeEvent &e)
double getMaxHFOV() const
get maximum possible hfov with current projection
wxColour m_preview_background_color
virtual void setName(const std::string &newName)
sets the name for the command
PreviewLayoutLinesTool * m_plane_layoutLinesTool
std::vector< wxCheckBox * > m_GroupToggleButtons
void AddImageToDragGroup(unsigned int image_nr, bool update_check_box=true)
void deregisterPTWXDlgFcn()
Dialog for setting output parameters for simple user interface.
wxChoice * m_ProjectionChoice
std::size_t getNrOfCtrlPoints() const
number of control points
bool set_contains(const _Container &c, const typename _Container::key_type &key)
#define DEBUG_ASSERT(cond)
PreviewIdentifyTool * plane_overview_identify_tool
void OnSelectDarkestMenu(wxCommandEvent &e)
HuginBase::ImageCache::ImageCacheRGB8Ptr ImageCacheRGB8Ptr
void setProjectionParameters(const std::vector< double > ¶ms)
set the optional parameters (they need to be of the correct size)
PreviewPanoMaskTool * pano_mask_tool
simple class that forward the drop to the mainframe
include file for the hugin project
int non_layout_blend_mode
void ForceRequireRedraw()
wxNotebook * m_tool_notebook
void InitPreviews()
init previews
virtual void run()
runs the algorithm.
Panorama getSubset(const UIntSet &imgs) const
get a subset of the panorama
const CPVector & getCtrlPoints() const
get all control point of this Panorama
PreviewControlPointTool * preview_control_point_tool
std::vector< wxPanel * > m_ToggleButtonPanel
void UpdateRoiDisplay(const HuginBase::PanoramaOptions opts)
update display of ROI
void OnPhotometric(wxCommandEvent &e)
wxTextCtrl * m_ROILeftTxt
remove several control points
represents a control point
PreviewDifferenceTool * plane_difference_tool
Definition of PanoOperation class.
void CleanButtonColours()
void findInterestPointsPartial(vigra::triple< ImageIter, ImageIter, ImageAcc > img, const vigra::Rect2D &rect, double scale, unsigned nPoints, std::multimap< double, vigra::Diff2D > &points)
void RemoveImageFromDragGroup(unsigned int image_nr, bool update_check_box=true)
wxChoice * m_GuideChoiceCrop
PanosphereOverviewOutlinesTool * overview_outlines_tool
std::vector< HuginBase::UIntSet > Components
stores the components of the graph
std::string doubleToString(double d, int digits)
convert a double to a string, suitable for display within a GUI.
static huginApp * Get()
hack.. kind of a pseudo singleton...
PanosphereSphereTool * panosphere_sphere_tool
void FillBlendChoice()
fills the blend wxChoice with all valid blend modes and restore the last used one ...
void OnActivate(wxActivateEvent &evt)
wxChoice * m_GuideChoiceDrag
PanoCommand to combine other PanoCommands.
Panorama duplicate() const
duplicate the panorama
wxStaticBoxSizer * m_ToggleButtonSizer
void OnSetCropAspect(wxCommandEvent &e)
event handler to set fixed aspect ratio of crop
void OnAutocropOutside(wxCommandEvent &e)
static hugin_omp::Lock cpLock
std::set< unsigned int > UIntSet
void OnDefaultExposure(wxCommandEvent &e)
bool individualDragging()
void OnOverviewModeChoice(wxCommandEvent &e)
algorithms for remove control points by statistic method
void OnProjParameterChanged(wxCommandEvent &e)
HuginBase::PanoramaOptions GetNewPanoramaOptions()
void LoadOpenGLLayout()
loads the layout of the OpenGL windows and restores it
wxChoice * m_ProjectionChoice
const vigra::Rect2D & getROI() const
void SetMode(OverviewMode mode)
wxSpinButton * m_rangeCompressionSpinBut
void OnHFOVChanged(wxCommandEvent &e)
void OnExposureChanged(wxCommandEvent &e)
wxMenu * m_filemenuSimple
wxBoxSizer * m_ButtonSizer
virtual ~GLPreviewFrame()
dtor.
PreviewLayoutLinesTool * m_panosphere_layoutLinesTool
void OnStackAutocrop(wxCommandEvent &e)
GLwxAuiManager * m_mgr
The dock manager.
void MakePreviewTools(PreviewToolHelper *helper)
void SetMode(int newMode)
virtual void panoramaImagesChanged(HuginBase::Panorama &pano, const HuginBase::UIntSet &changed)
notifies about changes to images
VariableMapVector getVariables() const
get variables of this panorama
void OnFullScreen(wxCommandEvent &e)
event handler for full screen
void OnSelectMedianMenu(wxCommandEvent &e)
std::vector< wxSlider * > m_projParamSlider
wxScrolledWindow * m_ButtonPanel
void resetProjectionParameters()
sets the optional parameters to their default values
void SetDragGroupImages(HuginBase::UIntSet imageDragGroup_in, bool update_check_box=true)
std::size_t getNrOfImages() const
number of images.
static MainFrame * Get()
hack.. kind of a pseudo singleton...
Definition of PanoOutputDialog class.
void AddUserDefinedSequence(int id, const wxString &desc, const wxString &help)
adds the given user defined output sequence to SplitButton menu
void SetGuiLevel(GuiLevel newLevel)
sets the gui level
void setCtrlPoints(const CPVector &points)
set all control points (Ippei: Is this supposed to be 'add' method?)
SplitButton * m_selectAllButton
void StoreFramePosition(wxTopLevelWindow *frame, const wxString &basename)
Store window size and position in configfile/registry.
float pow(float a, double b)
void redrawPreview()
Display an updated version of the preview images.
void remapImage(vigra::triple< ImgIter, ImgIter, ImgAccessor > srcImg, vigra_ext::Interpolator interpol, AppBase::ProgressDisplay *progress, bool singleThreaded=false)
remap a image without alpha channel
PreviewIdentifyTool * panosphere_overview_identify_tool
virtual vigra::Rect2D getResultOptimalROI()
return the ROI structure?, for now area
void OnSelectKeepSelection(wxCommandEvent &e)
wxMenu * m_filemenuAdvanced
RemapImage m_image
remapped image
double getMaxVFOV() const
get maximum possible vfov with current projection
Definition of dialog for selecting and editing aspect ratios of crop.
virtual double getResultMax()
virtual double getResultHeight()
std::vector< FindStruct > FindVector
PanoOperation to add several user selected images to the panorama.
PlaneOverviewOutlinesTool * plane_overview_outlines_tool
std::vector< wxTextCtrl * > m_projParamTextCtrl
Maximum of correlation, position and value.
std::string getLastCommandName() const
returns the name of the last command
wxInfoBar * m_infoBar
Bar for context sensitive projection information.
void OnToolModeChanging(wxNotebookEvent &e)
event handler for blocking changing mode when panorama contains no images
wxToggleButton * m_editCP_togglebutton
wxwindows specific panorama commands
std::map< std::string, std::string > FileMetaData
typedef for general map for storing metadata in files
SplitButton * m_loadImagesButton
std::vector< HuginBase::UIntVector > getSortedStacks(const HuginBase::Panorama *pano)
returns vector of UIntVector with image numbers of each stack sorted by exposure
PreviewControlPointTool * plane_control_point_tool
distributes all images above the sphere, for the assistant
wxPanel * m_projection_panel
void OnRangeCompressionChanged(wxCommandEvent &e)
void SetShowProjectionHints(bool new_value)
set status if projection hints should be shown or not
void UpdateIdentifyTools(std::set< unsigned int > new_image_set)
void RestoreFramePosition(wxTopLevelWindow *frame, const wxString &basename)
Restore window size and position from configfile/registry.
static GlobalCmdHist & getInstance()
PanosphereOverviewToolHelper * panosphere_overview_helper
virtual void SetLayoutMode(bool state)
std::multimap< double, vigra::Diff2D > MapPoints
void MakePanosphereOverviewTools(PanosphereOverviewToolHelper *helper)
void ShowMaskEditor(size_t imgNr, bool switchToCropMode=false)
opens the mask/crop editor with the given image selected
std::vector< ImageGroupButtonEventHandler * > toggle_group_button_event_handlers
wxToggleButton * m_identify_togglebutton
void addCommand(PanoCommand *command, bool execute=true)
Adds a command to the history.
void OnProjectionChoice(wxCommandEvent &e)
PreviewControlPointTool * panosphere_control_point_tool
PanosphereOverviewProjectionGridTool * overview_projection_grid
bool stringToDouble(const STR &str_, double &dest)
convert a string to a double, ignore localisation.
double GetSelectedAspectRatio() const
returns the selected aspect ratio
VisualizationState * m_visualization_state
void EnableGroupCheckboxes(bool isShown)
changes the visibility of the group check boxes
void OnSelectMode(wxNotebookEvent &e)
event handler for selection of new mode
void setROI(const vigra::Rect2D &val)
vigra::triple< typename ROIImage< Image, Mask >::image_const_traverser, typename ROIImage< Image, Mask >::image_const_traverser, typename ROIImage< Image, Mask >::ImageConstAccessor > srcImageRange(const ROIImage< Image, Mask > &img)
helper function for ROIImages
void ShowFisheyeCropHint()
void DragChoiceLayout(int index)
void OnSelectBrightestMenu(wxCommandEvent &e)
straighten panorama horizontically
void OnTrackChangeFOV(wxScrollEvent &e)
UIntSet getActiveImages() const
get active images
void MakePlaneOverviewTools(PlaneOverviewToolHelper *helper)
#define HUGIN_ASS_AUTO_ALIGN
void OnLayoutScaleChange(wxScrollEvent &e)
event handler for change scale of layout mode
OverviewDragTool * overview_drag_tool
GLOverview * m_GLOverview
bool m_selectKeepSelection
GLPreviewFrame(wxFrame *frame, HuginBase::Panorama &pano)
ctor.
void OnCenterHorizontally(wxCommandEvent &e)
virtual void SetLayoutScale(double scale)
void OnROIChanged(wxCommandEvent &e)
event handler for changed roi
wxChoice * m_BlendModeChoice
wxBoxSizer * m_projParamSizer
void OnLoadImages(wxCommandEvent &e)
void ShowProjectionWarnings()
Tell the user anything suspicious about the projection choice.
void OnUserExit(wxCommandEvent &e)
user wants to quit program
void setHFOV(double h, bool keepView=true)
set the horizontal field of view.
void OnGuideChanged(wxCommandEvent &e)
event handler when user selects different guide
void OnShowNone(wxCommandEvent &e)
void addObserver(PanoramaObserver *o)
add a panorama observer.
void OnDoStitch(wxCommandEvent &e)
unsigned int getWidth() const
include file for the hugin project
virtual void SetLayoutMode(bool state)
void OnMenuClose(wxMenuEvent &e)
handle menu close event
const PanoramaOptions & getOptions() const
returns the options for this panorama
void OnSelectAllMenu(wxCommandEvent &e)
handle all options of select all context menu
void OnSelectResetSelection(wxCommandEvent &e)
Handle EVT_KILL_FOCUS and convert it to a EVT_TEXT_ENTER event.
virtual double getResultHorizontalFOV()
virtual vigra::Rect2D getResultOptimalROI()
returns the found crop rect
void OnResetCrop(wxCommandEvent &e)
event handler to reset crop area
UIntSet getCPoutsideLimit(Panorama pano, double n, bool skipOptimisation, bool includeLineCp)
optimises the whole panorama and removes all control points with error > mean+n*sigma ...
PreviewToolHelper * preview_helper
wxTextCtrl * m_ROIBottomTxt
Components GetComponents()
find all connected components
subclass for a floating frame of the dock manager
SplitButton * m_alignButton
const std::vector< double > & getProjectionParameters() const
Get the optional projection parameters.
void OnIncreaseExposure(wxSpinEvent &e)
bool UpdateOverviewMode(int newMode)
updates the mode of the overview window
wxToggleButton * m_colorpicker_togglebutton
void OnRangeCompressionIncrease(wxSpinEvent &e)
bool m_showProjectionHints
void SetOptions(const HuginBase::PanoramaOptions *new_opts)
void OnCreateCP(wxCommandEvent &e)
handler for creating cp in pano space
void OnPreviewBackgroundColorChanged(wxColourPickerEvent &e)
event handler when user changes background color
void SetViewerBackground(wxColour col)
void OnDragChoice(wxCommandEvent &e)
hugin_utils::FDiff2D maxpos
PreviewColorPickerTool * color_picker_tool
void OnChangeFOV(wxScrollEvent &e)
std::vector< ControlPoint > CPVector
wxFileHistory * GetFileHistory()
void updateBlendMode()
Update tools and GUI elements according to blend mode choice.
bool HasNonZeroTranslationPlaneParameters()
check, if panorama has non-zero translation plane parameters
void OnEditCPTool(wxCommandEvent &e)
event handler when starting edit cp tool
PlaneOverviewToolHelper * plane_overview_helper
PreviewEditCPTool * edit_cp_tool
void OnBlendChoice(wxCommandEvent &e)
const SrcPanoImage & getImage(std::size_t nr) const
get a panorama image, counting starts with 0
wxTextCtrl * m_exposureTextCtrl
void OnShowEvent(wxShowEvent &e)
void OnAutocrop(wxCommandEvent &e)
bool needsOptimization()
true if control points or lens variables have been changed after the last optimisation ...
std::vector< wxStaticText * > m_projParamNamesLabel
PreviewProjectionGridTool * preview_projection_grid
void fill_set(_Container &c, typename _Container::key_type begin, typename _Container::key_type end)
update global white balance
customized subclass of the dock manager, created just for the purpose to create a workaround for the ...
void KeyDown(wxKeyEvent &e)
ProjectionFormat
Projection of final panorama.
HuginBase::Panorama & m_pano
void setSrcImage(unsigned int nr, const SrcPanoImage &img)
set input image parameters
PreviewGuideTool * preview_guide_tool
void ResetTranslationPlaneParameters()
resets all translation plane parameters to zero
virtual void panoramaChanged(HuginBase::Panorama &pano)
Notification about a Panorama change.
add multiple control points
wxChoice * m_GuideChoiceProj
PreviewCameraTool * camera_tool
void OnStraighten(wxCommandEvent &e)
All variables of a source image.
void setProjection(ProjectionFormat f)
set the Projection format and adjust the hfov/vfov if nessecary
static ViewState * m_view_state
PreviewLayoutLinesTool * m_preview_layoutLinesTool
void SetZoomLevel(const float new_zoom)
vigra::Size2D getSize() const
get size of output image
void UpdateGlobalWhiteBalance(double redFactor, double blueFactor)
updates the global white balance
void SetImageButtonColour(unsigned int image_nr, unsigned char red, unsigned char green, unsigned char blue)
void ResetPreviewZoom()
reset zoom level for preview window
void OnClose(wxCloseEvent &e)
struct to hold a image state for stitching
wxString Components2Str(const HuginGraph::ImageGraph::Components &comp)
HuginBase::UIntSet imageDragGroup
void OnNumTransform(wxCommandEvent &e)
void OnAlign(wxCommandEvent &e)
virtual bool hasRunSuccessfully()
wxChoice * m_OverviewModeChoice
PreviewDifferenceTool * difference_tool
void OnHideProjectionHints(wxCommandEvent &e)
event handler when user hides the infobar
void OnProjParameterReset(wxCommandEvent &e)
event handler for reset projection parameters
void TurnOffTools(std::set< Tool * > tools)
void LoadImages(int preferredLensType)
void KeyUp(wxKeyEvent &e)
void setWidth(unsigned int w, bool keepView=true)
set panorama width keep the HFOV, if keepView=true
double outputExposureValue
void OnFitPano(wxCommandEvent &e)
class to work with images graphs created from a HuginBase::Panorama class it creates a graph based on...