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, see
00023  *  <http://www.gnu.org/licenses/>.
00024  *
00025  */
00026 
00027 #ifndef LensCalImageCtrl_H
00028 #define LensCalImageCtrl_H
00029 
00030 #include <base_wx/wxImageCache.h>
00031 #include <lcms2.h>
00032 #include "lines/FindLines.h"
00033 #include "LensCalTypes.h"
00034 
00038 class LensCalImageCtrl : public wxPanel
00039 {
00040 public:
00041     enum LensCalPreviewMode
00042     {
00043         mode_original=0,
00044         mode_edge=1,
00045         mode_corrected=2
00046     };
00048     LensCalImageCtrl();
00050     void SetImage(ImageLineList* newList, unsigned int newIndex);
00052     void SetEmptyImage();
00056     void SetShowLines(bool showLines);
00058     void SetMode(const LensCalPreviewMode newMode);
00060     const LensCalPreviewMode GetMode();
00062     void SetLens(const HuginBase::SrcPanoImage::Projection newProjection,const double newFocallength, const double newCropfactor);
00064     void SetLensDistortions(const double newA, const double newB, const double newC, const double newD, const double newE);
00065 
00066 protected:
00068     void DrawView();
00069     void OnMouseEvent(wxMouseEvent &e);
00070 
00071 private:
00073     void Resize ( wxSizeEvent & e );
00075     void OnPaint(wxPaintEvent & dc);
00077     void SetEdgeImage();
00079     void GenerateRemappedImage(const unsigned int newWidth,const unsigned int newHeight);
00080 
00082     ImageLineList* m_imageLines;
00083     unsigned int m_imageIndex;
00085     wxImage m_img;
00087     vigra::BRGBImage m_edgeImage;
00089     vigra::BRGBImage m_remappedImage;
00091     wxImage m_edge;
00093     wxImage m_remapped_img;
00095     wxBitmap m_scaled_img;
00097     wxBitmap m_display_img;
00099     float m_scale;
00101     bool m_showLines;
00103     LensCalPreviewMode m_previewMode;
00105     cmsHPROFILE m_monitorProfile;
00107     bool m_hasMonitorProfile;
00108 
00109     // some actual lens parameters
00110     HuginBase::SrcPanoImage::Projection m_projection;
00111     double m_focallength;
00112     double m_cropfactor;
00113     double m_a;
00114     double m_b;
00115     double m_c;
00116     double m_d;
00117     double m_e;
00118     // SrcPanoImage and PanoramaOptions to calculate remapped image and transform lines
00119     HuginBase::SrcPanoImage m_panoimage;
00120     HuginBase::PanoramaOptions m_opts;
00121 
00122     DECLARE_EVENT_TABLE()
00123     DECLARE_DYNAMIC_CLASS(CenterCanvas)
00124 };
00125 
00127 class LensCalImageCtrlXmlHandler : public wxXmlResourceHandler
00128 {
00129     DECLARE_DYNAMIC_CLASS(LensCalImageCtrlXmlHandler)
00130 
00131 public:
00132     LensCalImageCtrlXmlHandler();
00133     virtual wxObject *DoCreateResource();
00134     virtual bool CanHandle(wxXmlNode *node);
00135 };
00136 
00137 #endif // LensCalImageCtrl_H

Generated on 2 Sep 2015 for Hugintrunk by  doxygen 1.4.7