LensCalImageCtrl.h

Go to the documentation of this file.
00001 // -*- c-basic-offset: 4 -*-
00011 /*  This is free software; you can redistribute it and/or
00012  *  modify it under the terms of the GNU General Public
00013  *  License as published by the Free Software Foundation; either
00014  *  version 2 of the License, or (at your option) any later version.
00015  *
00016  *  This software is distributed in the hope that it will be useful,
00017  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00018  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00019  *  Lesser General Public License for more details.
00020  *
00021  *  You should have received a copy of the GNU General Public
00022  *  License along with this software; if not, write to the Free Software
00023  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00024  *
00025  */
00026 
00027 #ifndef LensCalImageCtrl_H
00028 #define LensCalImageCtrl_H
00029 
00030 #include <base_wx/wxImageCache.h>
00031 #include "lines/FindLines.h"
00032 #include "LensCalTypes.h"
00033 
00037 class LensCalImageCtrl : public wxPanel
00038 {
00039 public:
00040     enum LensCalPreviewMode
00041     {
00042         mode_original=0,
00043         mode_edge=1,
00044         mode_corrected=2
00045     };
00047     LensCalImageCtrl();
00049     void SetImage(ImageLineList* newList, unsigned int newIndex);
00051     void SetEmptyImage();
00055     void SetShowLines(bool showLines);
00057     void SetMode(const LensCalPreviewMode newMode);
00059     const LensCalPreviewMode GetMode();
00061     void SetLens(const HuginBase::SrcPanoImage::Projection newProjection,const double newFocallength, const double newCropfactor);
00063     void SetLensDistortions(const double newA, const double newB, const double newC, const double newD, const double newE);
00064 
00065 protected:
00067     void DrawView();
00068     void OnMouseEvent(wxMouseEvent &e);
00069 
00070 private:
00072     void Resize ( wxSizeEvent & e );
00074     void OnPaint(wxPaintEvent & dc);
00076     void SetEdgeImage();
00078     void GenerateRemappedImage(const unsigned int newWidth,const unsigned int newHeight);
00079 
00081     ImageLineList* m_imageLines;
00082     unsigned int m_imageIndex;
00084     wxImage m_img;
00086     vigra::BRGBImage m_edgeImage;
00088     vigra::BRGBImage m_remappedImage;
00090     wxImage m_edge;
00092     wxImage m_remapped_img;
00094     wxBitmap m_scaled_img;
00096     wxBitmap m_display_img;
00098     float m_scale;
00100     bool m_showLines;
00102     LensCalPreviewMode m_previewMode;
00103 
00104     // some actual lens parameters
00105     HuginBase::SrcPanoImage::Projection m_projection;
00106     double m_focallength;
00107     double m_cropfactor;
00108     double m_a;
00109     double m_b;
00110     double m_c;
00111     double m_d;
00112     double m_e;
00113     // SrcPanoImage and PanoramaOptions to calculate remapped image and transform lines
00114     HuginBase::SrcPanoImage m_panoimage;
00115     HuginBase::PanoramaOptions m_opts;
00116 
00117     DECLARE_EVENT_TABLE()
00118     DECLARE_DYNAMIC_CLASS(CenterCanvas)
00119 };
00120 
00122 class LensCalImageCtrlXmlHandler : public wxXmlResourceHandler
00123 {
00124     DECLARE_DYNAMIC_CLASS(LensCalImageCtrlXmlHandler)
00125 
00126 public:
00127     LensCalImageCtrlXmlHandler();
00128     virtual wxObject *DoCreateResource();
00129     virtual bool CanHandle(wxXmlNode *node);
00130 };
00131 
00132 #endif // LensCalImageCtrl_H

Generated on Wed Jul 16 01:25:30 2014 for Hugintrunk by  doxygen 1.3.9.1