Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

Representations/Perception/CameraInfo.h

Go to the documentation of this file.
00001 /**
00002 * @file CameraInfo.h
00003 * 
00004 * Declaration of class CameraInfo
00005 *
00006 * @author <a href="mailto:juengel@informatik.hu-berlin.de">Matthias Juengel</a>
00007 * @author <a href="mailto:walter.nistico@uni-dortmund.de">Walter Nistico</a>
00008 */ 
00009 
00010 #ifndef __CameraInfo_h_
00011 #define __CameraInfo_h_
00012 
00013 #include "Tools/RobotConfiguration.h"
00014 #include "Tools/Streams/InOut.h"
00015 #include "Tools/Math/Vector2.h"
00016 
00017 //!@name camera resolution (currently used mode rather then all modes)
00018 //!@{
00019 const int cameraResolutionWidth_ERS210  = 176;
00020 const int cameraResolutionHeight_ERS210  = 144;
00021 const int cameraResolutionWidth_ERS7  = 208;
00022 const int cameraResolutionHeight_ERS7  = 160;
00023 //!@}
00024 
00025 //!@name opening angles of the camera
00026 //!@{
00027 const double openingAngleWidth_ERS210  = 1.012290966; // 58 * pi / 180
00028 const double openingAngleHeight_ERS210 = 0.837758041; // 48 * pi / 180
00029 const double openingAngleWidth_ERS7  =   0.993092344; // Sony: 56.9 * pi / 180
00030 const double openingAngleHeight_ERS7 =   0.788888822; // Sony: 45.2 * pi / 180
00031 //const double openingAngleWidth_ERS7  =   0.9653254990; // Thomas: 55.3 * pi / 180
00032 //const double openingAngleHeight_ERS7 =   0.7696185530; // Thomas: 44.1 * pi / 180
00033 //const double openingAngleWidth_ERS7  =   0.9512044423; // Walter: 54.5 * pi / 180
00034 //const double openingAngleHeight_ERS7 =   0.7539822369; // Walter: 43.2 * pi / 180
00035 //const double openingAngleWidth_ERS7  = 0.9075712110; // Matthias measured: 52 * pi / 180
00036 //const double openingAngleHeight_ERS7 = 0.6981317008; // Matthias measured: 40 * pi / 180
00037 //!@}
00038 
00039 //!@name camera intrinsic parameters
00040 //!@{
00041 const double focalLength_ERS210 = 159.1;
00042 const double opticalCenterX_ERS210 = 87.56;
00043 const double opticalCenterY_ERS210 = 73.82;
00044 const double secondOrderRadialDistortion_ERS210 = 0.0927;
00045 const double fourthOrderRadialDistortion_ERS210 = -0.451;
00046 
00047 const double focalLength_ERS7 = 201.75; 
00048 const double opticalCenterX_ERS7 = 102.1; 
00049 const double opticalCenterY_ERS7 = 82.4; 
00050 const double secondOrderRadialDistortion_ERS7 = -0.1538; 
00051 const double fourthOrderRadialDistortion_ERS7 = 0.2591; 
00052 /* NOTE: 
00053 * from intrinsic calculation, real angles seem to be: 
00054 * openingAngleWidth: 54.5°
00055 * openingAngleHeight: 43.2°
00056 * The narrower field of view of ERS7 compared to ERS210 is justified by the significantly lower distortion 
00057 * at borders and corners of the image (radial, mainly, maximum displacement is only 40% compared to old robot, 
00058 * while tangential is a lot higher (300%) but still negligible (up to 0.7 pixel displacement))
00059 * 
00060 */
00061 //!@}
00062 
00063 /**
00064 * Matrix describing transformation from neck joint to camera.
00065 */
00066 class CameraInfo
00067 {
00068 public:
00069   /** 
00070   * Default constructor. 
00071   * Sets the parameters for the ERS-7.
00072   */
00073   CameraInfo();
00074 
00075   /**
00076   * Constructor.
00077   * @param robotDesign Selects the robot the camera info is initialized for.
00078   */
00079   CameraInfo(RobotDesign::Design robotDesign);
00080 
00081   int resolutionWidth;
00082   int resolutionHeight;
00083   double openingAngleWidth;
00084   double openingAngleHeight;
00085 
00086   /** Intrinsic camera parameters: axis skew is modelled as 0 (90° perfectly orthogonal XY) 
00087   * and the same has been modeled for focal axis aspect ratio; distortion is considering
00088   * only 2nd and 4th order coefficients of radial model, which account for about 95% of total.
00089   */
00090   double focalLength;
00091   double focalLengthInv; // (1/focalLength) used to speed up certain calculations 
00092   Vector2<double> opticalCenter;
00093   double secondOrderRadialDistortion;
00094   double fourthOrderRadialDistortion;
00095   double focalLenPow2;  
00096   double focalLenPow4;
00097 
00098   /** Was the image generated by the simulator? */
00099   bool simulated;
00100 };
00101 
00102 /**
00103 * Streaming operator that reads a CameraInfo from a stream.
00104 * @param stream The stream from which is read.
00105 * @param cameraInfo The CameraInfo object.
00106 * @return The stream.
00107 */ 
00108 In& operator>>(In& stream,CameraInfo& cameraInfo);
00109 
00110 /**
00111 * Streaming operator that writes a CameraInfo to a stream.
00112 * @param stream The stream to write on.
00113 * @param cameraInfo The CameraInfo object.
00114 * @return The stream.
00115 */ 
00116 Out& operator<<(Out& stream, const CameraInfo& cameraInfo);
00117 
00118 #endif //__CameraInfo_h_
00119 
00120 /*
00121 * Change log :
00122 * 
00123 * $Log: CameraInfo.h,v $
00124 * Revision 1.3  2004/06/14 20:12:10  jhoffman
00125 * - numerous changes and additions to headcontrol
00126 * - cameraInfo default constructor now creates ERS7 info
00127 * - debug drawing "headcontrolfield" added
00128 *
00129 * Revision 1.2  2004/05/26 14:06:32  roefer
00130 * Corrected initialization of addition y channels in default constructor
00131 * Flag for simulated images added
00132 *
00133 * Revision 1.1.1.1  2004/05/22 17:25:44  cvsadm
00134 * created new repository GT2004_WM
00135 *
00136 * Revision 1.9  2004/03/27 10:21:58  roefer
00137 * Outcommented opening angles added
00138 *
00139 * Revision 1.8  2004/03/09 11:32:08  nistico
00140 * - Intrinsic parameters based measurements can now be triggered through a single conditional compilation
00141 * switch located in CameraInfo.h
00142 * - Implemented fast (look-up table based) radial distortion correction
00143 *
00144 * Revision 1.7  2004/02/24 18:46:00  dueffert
00145 * doxygen bug fixed
00146 *
00147 * Revision 1.6  2004/02/12 14:21:49  nistico
00148 * Calculated refined (4 robots used) intrinsic camera parameters for ERS-7
00149 * Fixed bug with ERS-7 logfiles and intrinsic camera parameters (formerly, they weren't correctly associated
00150 * with the higher resolution image from the new robot)
00151 *
00152 * Revision 1.5  2004/02/11 10:57:24  nistico
00153 * Calculated preliminary (only one robot used this far) intrinsic camera parameters for ERS-7
00154 *
00155 * Revision 1.4  2004/02/10 10:48:05  nistico
00156 * Introduced Intrinsic camera parameters to perform geometric calculations (distance, angle, size...) without opening angle
00157 * Implemented radial distortion correction function
00158 * Implemented ball distance calculation based on size and intrinsic params (potentially more stable)
00159 * To Be Done: calculate intrinsic params for ERS7, as soon as we get our puppies back
00160 *
00161 * Revision 1.3  2004/01/23 00:10:02  roefer
00162 * New constructor added, opening angles from Sony
00163 *
00164 * Revision 1.2  2004/01/04 18:18:49  juengel
00165 * Opening angles for ERS7.
00166 *
00167 * Revision 1.1  2003/12/15 11:13:15  juengel
00168 * Introduced CameraInfo
00169 *
00170 */

Generated on Thu Sep 23 19:57:36 2004 for GT2004 by doxygen 1.3.6