Hugin trunk 0.1
Loading...
Searching...
No Matches
PanoToolsInterface.h
Go to the documentation of this file.
1// -*- c-basic-offset: 4 -*-
24#ifndef _PANOTOOLS_PANOTOOLSINTERFACE_H
25#define _PANOTOOLS_PANOTOOLSINTERFACE_H
26
27#include <hugin_shared.h>
28#include <hugin_config.h>
29
30#include <iostream>
31#include <string>
32#include <set>
33
36#include <panodata/Lens.h>
40
41
42// libpano includes ------------------------------------------------------------
43
44#ifdef _WIN32
45// include windows.h with sensible defines, otherwise
46// panotools might include with its stupid, commonly
47// named macros all over the place.
48#define _STLP_VERBOSE_AUTO_LINK
49//#define _USE_MATH_DEFINES
50#define NOMINMAX
51#define VC_EXTRALEAN
52#include <windows.h>
53#undef DIFFERENCE
54#undef min
55#undef max
56#undef MIN
57#undef MAX
58#endif
59
60
61extern "C" {
62#ifdef __INTEL__
63#define __INTELMEMO__
64#undef __INTEL__
65#endif
66
67#include <pano13/panorama.h>
68#include <pano13/filter.h>
69
70#ifdef __INTELMEMO__
71#define __INTEL__
72#undef __INTELMEMO__
73#endif
74
75#include <pano13/filter.h>
76
77// somehow these are still set after panorama.h has been included
78#undef DIFFERENCE
79#undef min
80#undef max
81#undef MIN
82#undef MAX
83
84}
85
86//------------------------------------------------------------------------------
87
88
89namespace vigra { class Diff2D; }
90namespace HuginBase { class PanoramaData; }
91
92
93
101namespace HuginBase { namespace PTools {
102
103
106{
107
108 public:
116 : m_initialized(false), m_srcTX(0), m_srcTY(0),
117 m_destTX(0), m_destTY(0)
118 {
119 // initialize pointer
120 m_srcImage.data = NULL;
121 m_dstImage.data = NULL;
122 }
123
125 ~Transform();
126
127 private:
128 // private, no copy constructor for the pt structures yet.
131
132
133 public:
151 void createTransform(const vigra::Diff2D & srcSize,
154 const vigra::Diff2D &destSize,
156 const std::vector<double> & destProjParam,
157 double destHFOV,
158 const vigra::Diff2D & origSrcSize);
159
161 void createTransform(const PanoramaData& pano, unsigned int imgNr,
162 const PanoramaOptions & dest,
163 vigra::Diff2D srcSize=vigra::Diff2D(0,0));
164
166 void createTransform(const SrcPanoImage & src, const PanoramaOptions & dest);
167
185 void createInvTransform(const vigra::Diff2D & srcSize,
188 const vigra::Diff2D & destSize,
190 const std::vector<double> & destProjParam,
191 double destHFOV,
192 const vigra::Diff2D & origSrcSize);
193
195 void createInvTransform(const PanoramaData& pano, unsigned int imgNr,
196 const PanoramaOptions & dest,
197 vigra::Diff2D srcSize=vigra::Diff2D(0,0));
198
200 void createInvTransform(const SrcPanoImage & src, const PanoramaOptions & dest);
201
204 bool transform(double & x_dest, double & y_dest,
205 double x_src, double y_src) const;
206
208 bool transform(hugin_utils::FDiff2D& dest, const hugin_utils::FDiff2D & src) const;
209
213 bool transformImgCoord(double & x_dest, double & y_dest,
214 double x_src, double y_src) const;
215
216 bool transformImgCoordPartial(double & x_dest, double & y_dest, double x_src, double y_src) const;
217
220 { return transformImgCoord(dest.x, dest.y, src.x, src.y); }
221
222
223 bool emitGLSL(std::ostringstream& oss) const;
224
225 private:
226 // update internal PT data structs.
227 void updatePTData(const vigra::Diff2D &srcSize,
228 const VariableMap & srcVars,
230 const vigra::Diff2D & destSize,
232 const std::vector<double> & destProjParam,
233 double destHFOV);
234
235
236 private:
238
241 struct MakeParams m_mp;
242 struct fDesc m_stack[15];
243
244 // used to convert from screen to cartesian coordinates
245 double m_srcTX, m_srcTY;
246 double m_destTX, m_destTY;
247
248};
249
250
254IMPEX void setDestImage(Image & image, vigra::Diff2D size, unsigned char * imageData,
256 const std::vector<double> & projParams,
257 double destHFOV);
258
262IMPEX void setFullImage(Image & image, vigra::Diff2D size, unsigned char * imageData,
263 const VariableMap & vars,
265 bool correctDistortions);
266
271IMPEX void freeImage(Image &img);
272
275
278
279
280
281}} // namespace
282
283#endif // _H
Lens class.
Holds transformations for Image -> Pano and the other way.
Transform & operator=(const Transform &)
bool transformImgCoord(hugin_utils::FDiff2D &dest, const hugin_utils::FDiff2D &src) const
Transform()
construct a new Transform object, without initializing a transformation
Transform(const Transform &)
Model for a panorama.
Panorama image options.
ProjectionFormat
Projection of final panorama.
All variables of a source image.
misc math function & classes used by other parts of the program
#define IMPEX
void setDestImage(Image &image, vigra::Diff2D size, unsigned char *imageData, const PanoramaOptions::ProjectionFormat &format, const std::vector< double > &projParams, double destHFOV)
set an output image, with properties from opts, that points to the bitmap data of imgData
void setFullImage(Image &image, vigra::Diff2D size, unsigned char *imageData, const VariableMap &vars, const Lens::LensProjectionFormat format, bool correctDistortions)
fills image with a complete input image, including distortion correction parameters if correctDistort...
VariableMapVector GetAlignInfoVariables(const AlignInfo &gl)
CPVector GetAlignInfoCtrlPoints(const AlignInfo &gl)
void freeImage(Image &img)
free the pointer storage needed by Image
mainly consists of wrapper around the pano tools library, to assist in ressource management and to pr...
Definition wxcms.cpp:39
std::vector< VariableMap > VariableMapVector
std::vector< ControlPoint > CPVector
std::map< std::string, Variable > VariableMap
Implementation of fast vector type with support of linear algebra operations Copyright (C) 2009 Lukáš...
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