ViSP  2.9.0
vpMeterPixelConversion.h
1 /****************************************************************************
2  *
3  * $Id: vpMeterPixelConversion.h 4574 2014-01-09 08:48:51Z fspindle $
4  *
5  * This file is part of the ViSP software.
6  * Copyright (C) 2005 - 2014 by INRIA. All rights reserved.
7  *
8  * This software is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License
10  * ("GPL") version 2 as published by the Free Software Foundation.
11  * See the file LICENSE.txt at the root directory of this source
12  * distribution for additional information about the GNU GPL.
13  *
14  * For using ViSP with software that can not be combined with the GNU
15  * GPL, please contact INRIA about acquiring a ViSP Professional
16  * Edition License.
17  *
18  * See http://www.irisa.fr/lagadic/visp/visp.html for more information.
19  *
20  * This software was developed at:
21  * INRIA Rennes - Bretagne Atlantique
22  * Campus Universitaire de Beaulieu
23  * 35042 Rennes Cedex
24  * France
25  * http://www.irisa.fr/lagadic
26  *
27  * If you have questions regarding the use of this file, please contact
28  * INRIA at visp@inria.fr
29  *
30  * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
31  * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
32  *
33  *
34  * Description:
35  * Meter to pixel conversion.
36  *
37  * Authors:
38  * Eric Marchand
39  * Anthony Saunier
40  *
41  *****************************************************************************/
42 
43 
44 #ifndef vpMeterPixelConversion_H
45 #define vpMeterPixelConversion_H
46 
47 
54 #include <visp/vpCameraParameters.h>
55 #include<visp/vpException.h>
56 #include<visp/vpMath.h>
57 #include<visp/vpImagePoint.h>
58 
70 class VISP_EXPORT vpMeterPixelConversion
71 {
72 public:
73 
95  inline static void
97  const double &x, const double &y,
98  double &u, double &v)
99 
100  {
101  switch(cam.projModel){
103  convertPointWithoutDistortion(cam,x,y,u,v);
104  break;
106  convertPointWithDistortion(cam,x,y,u,v);
107  break;
108  }
109  }
110 
134  inline static void
136  const double &x, const double &y,
137  vpImagePoint &iP)
138 
139  {
140  switch(cam.projModel){
142  convertPointWithoutDistortion(cam,x,y,iP);
143  break;
145  convertPointWithDistortion(cam,x,y,iP);
146  break;
147  }
148  }
149 
159  inline static void
161  const double &x, const double &y,
162  double &u, double &v)
163 
164  {
165  u = x * cam.px + cam.u0 ;
166  v = y * cam.py + cam.v0 ;
167  }
168 
179  inline static void
181  const double &x, const double &y,
182  vpImagePoint &iP)
183 
184  {
185  iP.set_u( x * cam.px + cam.u0 );
186  iP.set_v( y * cam.py + cam.v0 );
187  }
188 
203  inline static void
205  const double &x, const double &y,
206  double &u, double &v)
207 
208  {
209  double r2 = 1.+cam.kud*(x*x+y*y);
210  u = cam.u0 + cam.px*x*r2;
211  v = cam.v0 + cam.py*y*r2;
212  }
213 
229  inline static void
231  const double &x, const double &y,
232  vpImagePoint &iP)
233 
234  {
235  double r2 = 1.+cam.kud*(x*x+y*y);
236  iP.set_u( cam.u0 + cam.px*x*r2 );
237  iP.set_v( cam.v0 + cam.py*y*r2 );
238  }
239 
241  static void convertLine(const vpCameraParameters &cam,
242  const double &rho_m, const double &theta_m,
243  double &rho_p, double &theta_p) ;
244 } ;
245 
246 #endif
247 
248 /*
249  * Local variables:
250  * c-basic-offset: 2
251  * End:
252  */
253 
Perspective projection without distortion model.
static void convertPointWithoutDistortion(const vpCameraParameters &cam, const double &x, const double &y, double &u, double &v)
Point coordinates conversion without distortion from normalized coordinates in meter to pixel coordi...
static void convertPoint(const vpCameraParameters &cam, const double &x, const double &y, vpImagePoint &iP)
Point coordinates conversion from normalized coordinates in meter to pixel coordinates.
static void convertPoint(const vpCameraParameters &cam, const double &x, const double &y, double &u, double &v)
Point coordinates conversion from normalized coordinates in meter to pixel coordinates ...
static void convertPointWithDistortion(const vpCameraParameters &cam, const double &x, const double &y, double &u, double &v)
Point coordinates conversion with distortion from normalized coordinates in meter to pixel coordinat...
void set_u(const double u)
Definition: vpImagePoint.h:216
static void convertPointWithDistortion(const vpCameraParameters &cam, const double &x, const double &y, vpImagePoint &iP)
Point coordinates conversion with distortion from normalized coordinates in meter to pixel coordinat...
void set_v(const double v)
Definition: vpImagePoint.h:227
Generic class defining intrinsic camera parameters.
Perspective projection with distortion model.
Conversion from normalized coordinates in meter to pixel coordinates .
static void convertPointWithoutDistortion(const vpCameraParameters &cam, const double &x, const double &y, vpImagePoint &iP)
Point coordinates conversion without distortion from normalized coordinates in meter to pixel coordi...
Class that defines a 2D point in an image. This class is useful for image processing and stores only ...
Definition: vpImagePoint.h:92