Basic Image AlgorithmS Library  2.8.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
ImageWarper.hh
1 /*
2 This file is part of the BIAS library (Basic ImageAlgorithmS).
3 
4 Copyright (C) 2003, 2004 (see file CONTACTS 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 IMAGEWARPER_HH
26 #define IMAGEWARPER_HH
27 
28 #include <BIAS_DeclSpec.hh>
29 #include <Image/Camera.hh>
30 #include <OpenGLFramework/Base/glfFramebufferObject.hh>
31 #include <OpenGLFramework/RenderingContext/glfPBuffer.hh>
32 #include <Geometry/ProjectionParametersPerspective.hh>
33 #include <OpenGLFramework/SpecializedBatches/PMDWarp.hh>
34 
35 namespace BIAS {
36 
37 /**
38  * \class ImageWarper
39  * \brief this class warpes depth images from one persective to the perspective of
40  * another camera. In principle it wraps the classes PMDWarp, glfPBuffer,
41  * glfFramebufferObject and others to warp using an own context and own textures
42  * \author ischiller
43  * \date 10/2010
44  */
45 template<class StorageType>
46 class BIASOpenGLFramework_EXPORT ImageWarper : public BIAS::Camera<StorageType> {
47 
48 public:
49  ImageWarper(bool ignoreRadialDistortion = false);
50  ~ImageWarper();
51 
52  /** \brief Init the warping with projection parameters */
55  float minZ=500, float maxZ=7500.0);
56  /** \brief Process one warping from source to target parameters
57  * \param depthImage[in]: the depth image
58  * \param warpedDepthImage[out]: the resulting warped depth image
59  * \param getdepth[in]: say whether to get depth (true)
60  * or zdepth from 0 to 1 (false). default = false
61  */
62  int Process(BIAS::Image<StorageType>& depthImage,
63  BIAS::Image<StorageType>& warpedDepthImage,
64  float minZ=500, float maxZ=7500.0, bool getdepth=false);
65 
66  /** \brief Process one warping from source to target parameters including color
67  * texture information which has to have the same dimension as the depth images.
68  * \param depthImage[in]: the depth image
69  * \param colorImage[in]: the color image
70  * \param warpedDepthImage[out]: the resulting warped depth image
71  * \param warpedColorImage[out]: the resulting warped color image
72  * \param getdepth[in]: say whether to get depth (true)
73  * or zdepth from 0 to 1 (false). default = false*/
74  int ProcessWithColor(BIAS::Image<StorageType>& depthImage,
75  BIAS::Image<unsigned char>& colorImage,
76  BIAS::Image<StorageType>& warpedDepthImage,
77  BIAS::Image<unsigned char>& warpedColorImage,
78  float minZ, float maxZ, bool getdepth=false);
79 
80  /** \brief ppp extrinsicis have to be in global coordinates of pppd of Init call! **/
82  depthMeshing_.UseProjectiveTexturing(ppp);
83  };
84 
85  int SetTargetCamera(BIAS::ProjectionParametersPerspective& target,
86  float minZ=500, float maxZ=7500.0);
87 
88  void IgnoreRadialDistortion(bool ignoreRadialDistortion = true){
89  ignoreRadialDist_=ignoreRadialDistortion;
90  };
91 
92  bool IsInitialized(){return inited_;};
93 
94 private:
95 
96  void SetDefaultTextureParameters_(BIAS::glfTexture2D& t);
97  void InitFBOTexture_(BIAS::glfTexture2D& tex,unsigned width,
98  unsigned height,GLenum intFormat);
99 
100 private:
101  bool inited_,ignoreRadialDist_;
102  unsigned width_,height_;
103  BIAS::glfFramebufferObject depthWarpFBO_;
104 
105  BIAS::glfTexture2D resultTexture;
106  BIAS::glfTexture2D depthTexture;
107 
108  BIAS::PMDWarp depthMeshing_;
109  BIAS::glfPBuffer pBuffer_;
111 
112 };
113 }
114 #endif
void UseProjectiveTexturing(const BIAS::ProjectionParametersPerspective &ppp)
ppp extrinsicis have to be in global coordinates of pppd of Init call!
Definition: ImageWarper.hh:81
A 2D texture.
Definition: glfTexture2D.hh:40
extends the Image by MetaData support (e.g.
Definition: Camera.hh:74
camera parameters which define the mapping between rays in the camera coordinate system and pixels in...
this class warpes depth images from one persective to the perspective of another camera.
Definition: ImageWarper.hh:46
GLX pbuffer rendering context.
The image template class for specific storage types.
Definition: Image.hh:78
void IgnoreRadialDistortion(bool ignoreRadialDistortion=true)
Definition: ImageWarper.hh:88
class can be used to warp sequences of pmd depth images into a second view with different parameters...
Definition: PMDWarp.hh:61