Hugin trunk 0.1
Loading...
Searching...
No Matches
CPEditorPanel.h
Go to the documentation of this file.
1// -*- c-basic-offset: 4 -*-
24#ifndef _CPEDITORPANEL_H
25#define _CPEDITORPANEL_H
26
27
28//-----------------------------------------------------------------------------
29// Headers
30//-----------------------------------------------------------------------------
31
32#include <vector>
33#include <set>
34#include <functional>
35#include <utility>
36#include <string>
37
38// Celeste files
39#include "Celeste.h"
40#include "CelesteGlobals.h"
41#include "Utilities.h"
42
43#include <panodata/Panorama.h>
44
45#include "CPImagesComboBox.h"
46
47#include "CPImageCtrl.h"
49
50namespace vigra {
51 class Diff2D;
52}
53
54namespace vigra_ext{
55 struct CorrelationResult;
56}
57
64class CPEditorPanel : public wxPanel, public HuginBase::PanoramaObserver
65{
66public:
70
71 bool Create(wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxTAB_TRAVERSAL, const wxString& name = "panel");
72
73 void Init(HuginBase::Panorama * pano);
74
77 virtual ~CPEditorPanel();
78
80 void setLeftImage(unsigned int imgNr);
82 void setRightImage(unsigned int imgNr);
83
86
92
93
101 void SelectGlobalPoint(unsigned int globalNr);
102
107 void ShowControlPoint(unsigned int cpNr);
108
110 void ClearSelection();
111
112private:
113
117 void UpdateDisplay(bool newImages);
118
120 void EnablePointEdit(bool state);
121
127 void SelectLocalPoint(unsigned int LVpointNr, bool scrollLeft = true, bool scrollRight = true);
128
130 bool globalPNr2LocalPNr(unsigned int & localNr, unsigned int globalNr) const;
132 unsigned int localPNr2GlobalPNr(unsigned int localNr) const;
133
134 // function called when a new point has been selected or changed
135 // in one of your images
136 void NewPointChange(hugin_utils::FDiff2D p, bool left);
137// void CreateNewPointRight(wxPoint p);
138
140 void CreateNewPoint();
141
143// bool FindTemplate(unsigned int tmplImgNr, const wxRect &region, unsigned int dstImgNr, vigra_ext::CorrelationResult & res);
144
145 bool PointFineTune(unsigned int tmplImgNr,
146 const vigra::Diff2D &tmplPoint,
147 int tmplWidth,
148 unsigned int subjImgNr,
150 int searchWidth,
152
153 const float getVerticalCPBias();
154 // event handler functions
155 void OnCPEvent(CPEvent &ev);
156 void OnLeftChoiceChange(wxCommandEvent & e);
157 void OnRightChoiceChange(wxCommandEvent & e);
158 void OnCPListSelect(wxListEvent & e);
160 void OnAddButton(wxCommandEvent & e);
161 void OnZoom(wxCommandEvent & e);
162 void OnTextPointChange(wxCommandEvent &e);
163 void OnKey(wxKeyEvent & e);
164 void OnDeleteButton(wxCommandEvent & e);
165 void OnPrevImg(wxCommandEvent & e);
166 void OnNextImg(wxCommandEvent & e);
167
170
171 void OnFineTuneButton(wxCommandEvent & e);
172 void OnActionButton(wxCommandEvent& e);
173 void OnCreateCPButton(wxCommandEvent& e);
174 void OnCelesteButton(wxCommandEvent & e);
175 void OnCleanCPButton(wxCommandEvent& e);
176 void OnShowLinesCheckbox(wxCommandEvent& e);
177
178 void OnActionSelectCreate(wxCommandEvent& e);
179 void OnActionSelectCeleste(wxCommandEvent& e);
180 void OnActionSelectCleanCP(wxCommandEvent& e);
182
183 void FineTuneSelectedPoint(bool left);
184 void FineTuneNewPoint(bool left);
185 // local fine tune
187 const vigra::Diff2D & srcPnt,
189 unsigned int moveNr,
191
198
199
210 // used to change the point selection state
212
215 bool left,
217 unsigned int thisImgNr,
221 unsigned int otherImgNr,
224
226 CPImageCtrl::ImageRotation GetRot(double yaw, double roll, double pitch);
228 void UpdateTransforms();
230 void SortList();
231
233
243 // GUI controls
247 wxListCtrl *m_cpList;
248
262 wxPanel *m_cp_ctrls;
263
264 // my data
266 // the current images
267 unsigned int m_leftImageNr;
268 unsigned int m_rightImageNr;
269 std::string m_leftFile;
270 std::string m_rightFile;
273 // store transformation for drawing line control points
278 // store transformation for drawing the magnifier
283
284 unsigned int m_selectedPoint;
285
286 // contains the control points shown currently.
288 // this set contains all points that are mirrored (point 1 in right window,
289 // point 2 in left window), in local point numbers
290 std::set<unsigned int> mirroredPoints;
291 size_t m_countCP;
292 // store current sorting column
293 long m_sortCol = -1;
294 bool m_sortAscending = true;
295
298
306
308
309};
310
313 vigra::Diff2D templPos, int templSize,
314 const HuginBase::SrcPanoImage& search, const vigra::UInt8RGBImage& searchImg,
315 vigra::Diff2D searchPos, int sWidth);
316
318class CPEditorPanelXmlHandler : public wxXmlResourceHandler
319{
321
322public:
324 virtual wxObject *DoCreateResource();
325 virtual bool CanHandle(wxXmlNode *node);
326};
327
328#endif // _CPEDITORPANEL_H
vigra_ext::CorrelationResult PointFineTuneProjectionAware(const HuginBase::SrcPanoImage &templ, const vigra::UInt8RGBImage &templImg, vigra::Diff2D templPos, int templSize, const HuginBase::SrcPanoImage &search, const vigra::UInt8RGBImage &searchImg, vigra::Diff2D searchPos, int sWidth)
function for fine-tune with remapping to stereographic projection
Definition of CPImagesComboBox and CPImagesComboBoxXmlHandler class.
virtual bool CanHandle(wxXmlNode *node)
virtual wxObject * DoCreateResource()
control point editor panel.
CPImageCtrl::ImageRotation m_leftRot
HuginBase::PTools::Transform m_leftTransform
void SelectGlobalPoint(unsigned int globalNr)
Select a point.
wxChoice * m_cpModeChoice
bool globalPNr2LocalPNr(unsigned int &localNr, unsigned int globalNr) const
map a global point nr to a local one, if possible
wxPanel * m_cp_ctrls
wxCheckBox * m_showLinesCB
void OnPrevImg(wxCommandEvent &e)
void OnDeleteButton(wxCommandEvent &e)
void OnZoom(wxCommandEvent &e)
hugin_utils::FDiff2D LocalFineTunePoint(unsigned int srcNr, const vigra::Diff2D &srcPnt, hugin_utils::FDiff2D &movedSrcPnt, unsigned int moveNr, const hugin_utils::FDiff2D &movePnt)
void estimateAndAddOtherPoint(const hugin_utils::FDiff2D &p, bool left, CPImageCtrl *thisImg, unsigned int thisImgNr, CPCreationState THIS_POINT, CPCreationState THIS_POINT_RETRY, CPImageCtrl *otherImg, unsigned int otherImgNr, CPCreationState OTHER_POINT, CPCreationState OTHER_POINT_RETRY)
estimate and set point in other image
void OnActionSelectCleanCP(wxCommandEvent &e)
void CreateNewPoint()
this is used to finally create the point in the panorama model
wxListCtrl * m_cpList
void OnFineTuneButton(wxCommandEvent &e)
HuginBase::PTools::Transform m_leftInvTransform
CPTabActionButtonMode m_cpActionButtonMode
CPImagesComboBox * m_leftChoice
wxCheckBox * m_fineTuneCB
void OnActionButton(wxCommandEvent &e)
wxCheckBox * m_autoAddCB
void OnShowLinesCheckbox(wxCommandEvent &e)
void OnKey(wxKeyEvent &e)
wxButton * m_delButton
void OnCPListSelect(wxListEvent &e)
CPCreationState
the state machine for point selection: it is set to the current selection
@ BOTH_POINTS_SELECTED
left and right point selected, waiting for add point.
@ LEFT_POINT
point in left image selected
@ LEFT_POINT_RETRY
right point, finetune for left point failed
@ RIGHT_POINT
selected point in right image
@ RIGHT_POINT_RETRY
point in left image selected, finetune failed in right image
@ NO_POINT
no point selected
void UpdateTransforms()
updated the internal transform object for drawing line in controls
void OnCreateCPButton(wxCommandEvent &e)
virtual ~CPEditorPanel()
dtor.
hugin_utils::FDiff2D EstimatePoint(const hugin_utils::FDiff2D &p, bool left)
Estimate position of point in the other image.
void FineTuneNewPoint(bool left)
void setRightImage(unsigned int imgNr)
set right image
void panoramaImagesChanged(HuginBase::Panorama &pano, const HuginBase::UIntSet &imgNr)
notifies about changes to images
wxChoice * m_zoomChoice
HuginBase::PTools::Transform m_rightTransform
wxButton * m_addButton
wxTextCtrl * m_x1Text
void UpdateDisplay(bool newImages)
updates the display after another image has been selected.
void OnColumnWidthChange(wxListEvent &e)
unsigned int m_rightImageNr
wxCheckBox * m_estimateCB
CPScrollHint m_scrollHint
void Init(HuginBase::Panorama *pano)
bool Create(wxWindow *parent, wxWindowID id=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxTAB_TRAVERSAL, const wxString &name="panel")
std::string m_rightFile
wxTextCtrl * m_errorText
void SortList()
sorting functions
void OnNextImg(wxCommandEvent &e)
void FineTuneSelectedPoint(bool left)
void OnActionContextMenu(wxContextMenuEvent &e)
std::string m_leftFile
HuginBase::Panorama * m_pano
HuginBase::PTools::Transform m_leftInvTransformMag
HuginBase::PTools::Transform m_rightInvTransform
void OnActionSelectCeleste(wxCommandEvent &e)
void OnActionSelectCreate(wxCommandEvent &e)
unsigned int m_selectedPoint
void panoramaChanged(HuginBase::Panorama &pano)
called when the panorama changes and we should update our display
HuginBase::PTools::Transform m_rightInvTransformMag
bool PointFineTune(unsigned int tmplImgNr, const vigra::Diff2D &tmplPoint, int tmplWidth, unsigned int subjImgNr, const hugin_utils::FDiff2D &subjPoint, int searchWidth, vigra_ext::CorrelationResult &tunedPos)
search for region in destImg
void SelectLocalPoint(unsigned int LVpointNr, bool scrollLeft=true, bool scrollRight=true)
select a local point.
wxButton * m_prevImgButton
void OnLeftChoiceChange(wxCommandEvent &e)
CPImageCtrl * m_leftImg
CPImageCtrl * m_rightImg
const float getVerticalCPBias()
CPCreationState cpCreationState
void OnCelesteButton(wxCommandEvent &e)
void OnColumnHeaderClick(wxListEvent &e)
void EnablePointEdit(bool state)
enable or disable controls for editing other points
wxMenu * m_cpActionContextMenu
void setLeftImage(unsigned int imgNr)
set left image
void SetPano(HuginBase::Panorama *panorama)
void changeState(CPCreationState newState)
void OnCleanCPButton(wxCommandEvent &e)
wxTextCtrl * m_y1Text
wxButton * m_finetuneButton
std::set< unsigned int > mirroredPoints
void OnTextPointChange(wxCommandEvent &e)
void OnRightChoiceChange(wxCommandEvent &e)
wxString m_currentCPDetector
wxButton * m_nextImgButton
CPImageCtrl::ImageRotation GetRot(double yaw, double roll, double pitch)
calculate rotation required for upright image display from roll, pitch and yaw angles
unsigned int m_leftImageNr
wxTextCtrl * m_x2Text
bool m_listenToPageChange
CPImageCtrl::ImageRotation m_rightRot
void NewPointChange(hugin_utils::FDiff2D p, bool left)
wxButton * m_actionButton
void ClearSelection()
unselect a point
double m_detailZoomFactor
wxTextCtrl * m_y2Text
HuginBase::PTools::Transform m_rightTransformMag
void OnCPListDeselect(wxListEvent &e)
void OnCPEvent(CPEvent &ev)
unsigned int localPNr2GlobalPNr(unsigned int localNr) const
find a local point
void OnAddButton(wxCommandEvent &e)
CPImagesComboBox * m_rightChoice
void ShowControlPoint(unsigned int cpNr)
show a control point
HuginBase::PTools::Transform m_leftTransformMag
HuginBase::CPointVector currentPoints
Events to notify about new point / region / point change.
Definition CPImageCtrl.h:41
brief description.
ImageRotation
image rotation.
Owner Drawn ComboBox for showing connected images on CP tab.
Holds transformations for Image -> Pano and the other way.
this handler class will receive change events from the Panorama.
Model for a panorama.
Definition Panorama.h:153
All variables of a source image.
std::vector< CPoint > CPointVector
std::set< unsigned int > UIntSet
Implementation of fast vector type with support of linear algebra operations Copyright (C) 2009 Lukáš...
Maximum of correlation, position and value.
Definition Correlation.h:57
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.
Definition threshold.h:41