Basic Image AlgorithmS Library  2.8.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
CylinderMapping.hh
1 /*
2 This file is part of the BIAS library (Basic ImageAlgorithmS).
3 
4 Copyright (C) 2003-2009 (see file CONTACT for details)
5  Multimediale Systeme der Informationsverarbeitung
6  Institut fuer Informatik
7  Christian-Albrechts-Universitaet Kiel
8 
9 
10 BIAS is free software; you can redistribute it and/or modify
11 it under the terms of the GNU Lesser General Public License as published by
12 the Free Software Foundation; either version 2.1 of the License, or
13 (at your option) any later version.
14 
15 BIAS is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU Lesser General Public License for more details.
19 
20 You should have received a copy of the GNU Lesser General Public License
21 along with BIAS; if not, write to the Free Software
22 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 */
24 
25 #ifndef __BIAS_CylinderMapping_hh__
26 #define __BIAS_CylinderMappibg_hh__
27 
28 // BIAS includes
29 #include <Base/Image/Image.hh>
30 #include <Image/BackwardMapping.hh>
31 #include <Geometry/PMatrix.hh>
32 
33 namespace BIAS {
34 
35  /** @class CylinderMapping
36  @brief functions for spherical undistortion of given images,
37  needs image dimensions,
38  principal point and focal length as input additional
39  to the image data.
40 
41  Useful for PanoramaMapping !
42  See also BIAS::BackwardMapping for further details.
43 
44  @author jbr, february 2006 edited by grest
45  */
46  class BIASImage_EXPORT CylinderMapping :
47  public BIAS::BackwardMapping<unsigned char, unsigned char> {
48 
49  public:
50 
52 
53  /** Set the focal length of the camera.
54  Defaults to 140 degrees field of view in y-direction
55  @param fx
56  @param fy
57  */
58  void setFocalLength(const double fx, const double fy);
59 
60 
61  /** Set the principal point of the camera
62  @param px defaults to half image size
63  @param py defaults to half image size
64  */
65  void setPrincipalPoint(const double px, const double py);
66 
67 
68  /** if you want to call Map() twice for this object with different
69  params, call Reset() before
70  */
71  void Reset();
72 
73  protected:
74 
75  /** this does the trick
76  */
77  virtual int GetSourceCoordinates_(const BIAS::HomgPoint2D& sink,
78  BIAS::HomgPoint2D& source) const;
79 
80  double px_; // principal x
81  double py_; // principal y
82 
83  double focalX_;
84  double focalY_;
85  double camAngleX_; // camera opening angle in x-direction
86  double camAngleY_; // camera opening angle in y-direction
87 
88 };
89 
90 }
91 #endif
class HomgPoint2D describes a point with 2 degrees of freedom in projective coordinates.
Definition: HomgPoint2D.hh:67
Abstract base class to map an image (texture) src to an image sink with an arbitrary continuous funct...
functions for spherical undistortion of given images, needs image dimensions, principal point and foc...