Hugintrunk  0.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
LensCalImageCtrl.h
Go to the documentation of this file.
1 // -*- c-basic-offset: 4 -*-
11 /* This is free software; you can redistribute it and/or
12  * modify it under the terms of the GNU General Public
13  * License as published by the Free Software Foundation; either
14  * version 2 of the License, or (at your option) any later version.
15  *
16  * This software is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19  * Lesser General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public
22  * License along with this software. If not, see
23  * <http://www.gnu.org/licenses/>.
24  *
25  */
26 
27 #ifndef LensCalImageCtrl_H
28 #define LensCalImageCtrl_H
29 
30 #include <base_wx/wxImageCache.h>
31 #include <lcms2.h>
32 #include "lines/FindLines.h"
33 #include "LensCalTypes.h"
34 
38 class LensCalImageCtrl : public wxPanel
39 {
40 public:
42  {
46  };
50  void SetImage(ImageLineList* newList, unsigned int newIndex);
52  void SetEmptyImage();
56  void SetShowLines(bool showLines);
58  void SetMode(const LensCalPreviewMode newMode);
62  void SetLens(const HuginBase::SrcPanoImage::Projection newProjection,const double newFocallength, const double newCropfactor);
64  void SetLensDistortions(const double newA, const double newB, const double newC, const double newD, const double newE);
65 
66 protected:
68  void DrawView();
69  void OnMouseEvent(wxMouseEvent &e);
70 
71 private:
73  void Resize ( wxSizeEvent & e );
75  void OnPaint(wxPaintEvent & dc);
77  void SetEdgeImage();
79  void GenerateRemappedImage(const unsigned int newWidth,const unsigned int newHeight);
80 
83  unsigned int m_imageIndex;
85  wxImage m_img;
87  vigra::BRGBImage m_edgeImage;
89  vigra::BRGBImage m_remappedImage;
91  wxImage m_edge;
93  wxImage m_remapped_img;
95  wxBitmap m_scaled_img;
97  wxBitmap m_display_img;
99  float m_scale;
105  cmsHPROFILE m_monitorProfile;
108 
109  // some actual lens parameters
112  double m_cropfactor;
113  double m_a;
114  double m_b;
115  double m_c;
116  double m_d;
117  double m_e;
118  // SrcPanoImage and PanoramaOptions to calculate remapped image and transform lines
121 
122  DECLARE_EVENT_TABLE()
123  DECLARE_DYNAMIC_CLASS(CenterCanvas)
124 };
125 
127 class LensCalImageCtrlXmlHandler : public wxXmlResourceHandler
128 {
129  DECLARE_DYNAMIC_CLASS(LensCalImageCtrlXmlHandler)
130 
131 public:
133  virtual wxObject *DoCreateResource();
134  virtual bool CanHandle(wxXmlNode *node);
135 };
136 
137 #endif // LensCalImageCtrl_H
xrc handler for LensCalImageCtrl
void SetEmptyImage()
set preview to empty image
image previewer for lens calibration GUI
bool m_hasMonitorProfile
true, if we found a real monitor profile
void GenerateRemappedImage(const unsigned int newWidth, const unsigned int newHeight)
generates the remapped image suitable for wxImage
declaration of functions for finding lines
wxBitmap m_scaled_img
the scaled image to save resizing
LensCalPreviewMode m_previewMode
which image should be drawn
void SetEdgeImage()
converts the edge image into wxImage
wxImage m_remapped_img
the remapped image as wxImage
ImageLineList * m_imageLines
struct with filename, edge image and detected lines
void DrawView()
draw the view into the offscreen buffer
void OnPaint(wxPaintEvent &dc)
paint event
HuginBase::PanoramaOptions m_opts
vigra::BRGBImage m_remappedImage
the remapped image
LensCalImageCtrl()
constructor
void Resize(wxSizeEvent &e)
resize event, recalculates the offscreen buffer
wxImage m_edge
the edge detect image (resized scale)
HuginBase::SrcPanoImage::Projection m_projection
unsigned int m_imageIndex
void OnMouseEvent(wxMouseEvent &e)
const LensCalPreviewMode GetMode()
return actual preview mode
void SetImage(ImageLineList *newList, unsigned int newIndex)
set preview setting to given ImageLineList
wxBitmap m_display_img
the image to display, e.g.
cmsHPROFILE m_monitorProfile
monitor profile
declaration of helper class for LensCal
HuginBase::SrcPanoImage m_panoimage
void SetLens(const HuginBase::SrcPanoImage::Projection newProjection, const double newFocallength, const double newCropfactor)
updates the internal values of the lens (needed only for remapped image)
wxImage m_img
the image to adjust (full scale)
All variables of a source image.
Definition: SrcPanoImage.h:194
bool m_showLines
true, if the lines should be drawn above the image
Panorama image options.
void SetMode(const LensCalPreviewMode newMode)
set which image (original, edge, remapped/corrected) should be drawn
void SetLensDistortions(const double newA, const double newB, const double newC, const double newD, const double newE)
updates the internal values of the lens distortions parameters (needed only for remapped image) ...
float m_scale
scale factor for scaling from m_img to m_scaled_img
void SetShowLines(bool showLines)
vigra::BRGBImage m_edgeImage
the edge image as RGBImage (in m_imageLines the edge image is grayscale (vigra::BImage)) ...