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/Streams/Streamable.h"
    00016 #include "Tools/Math/Vector2.h"
    00017
    00018
    00019 //!@name camera resolution (currently used mode rather then all modes)
    00020 //!@{
    00021 const int cameraResolutionWidth_ERS210  = 176;
    00022 const int cameraResolutionHeight_ERS210  = 144;
    00023 const int cameraResolutionWidth_ERS7  = 208;
    00024 const int cameraResolutionHeight_ERS7  = 160;
    00025 //!@}
    00026
    00027 //!@name opening angles of the camera
    00028 //!@{
    00029 const double openingAngleWidth_ERS210  = 1.012290966; // 58 * pi / 180
    00030 const double openingAngleHeight_ERS210 = 0.837758041; // 48 * pi / 180
    00031 const double openingAngleWidth_ERS7  =   0.993092344; // Sony: 56.9 * pi / 180
    00032 const double openingAngleHeight_ERS7 =   0.788888822; // Sony: 45.2 * pi / 180
    00033 //const double openingAngleWidth_ERS7  =   0.9653254990; // Thomas: 55.3 * pi / 180
    00034 //const double openingAngleHeight_ERS7 =   0.7696185530; // Thomas: 44.1 * pi / 180
    00035 //const double openingAngleWidth_ERS7  =   0.9512044423; // Walter: 54.5 * pi / 180
    00036 //const double openingAngleHeight_ERS7 =   0.7539822369; // Walter: 43.2 * pi / 180
    00037 //const double openingAngleWidth_ERS7  = 0.9075712110; // Matthias measured: 52 * pi / 180
    00038 //const double openingAngleHeight_ERS7 = 0.6981317008; // Matthias measured: 40 * pi / 180
    00039 //!@}
    00040
    00041 //!@name camera intrinsic parameters
    00042 //!@{
    00043 const double focalLength_ERS210 = 159.1;
    00044 const double focalLengthMM_ERS210 = 2.18;
    00045 const double pixelPerMM_ERS210 = 72.98;
    00046 const double opticalCenterX_ERS210 = 87.56;
    00047 const double opticalCenterY_ERS210 = 73.82;
    00048 const double secondOrderRadialDistortion_ERS210 = 0.0927;
    00049 const double fourthOrderRadialDistortion_ERS210 = -0.451;
    00050
    00051 const double focalLength_ERS7 = 201.75;
    00052 const double focalLengthMM_ERS7 = 3.27;
    00053 const double pixelPerMM_ERS7 = 61.7;
    00054 const double opticalCenterX_ERS7 = 102.1;
    00055 const double opticalCenterY_ERS7 = 82.4;
    00056 const double secondOrderRadialDistortion_ERS7 = -0.1538;
    00057 const double fourthOrderRadialDistortion_ERS7 = 0.2591;
    00058 /* NOTE:
    00059 * from intrinsic calculation, real angles seem to be:
    00060 * openingAngleWidth: 54.5°
    00061 * openingAngleHeight: 43.2°
    00062 * The narrower field of view of ERS7 compared to ERS210 is justified by the significantly lower distortion
    00063 * at borders and corners of the image (radial, mainly, maximum displacement is only 40% compared to old robot,
    00064 * while tangential is a lot higher (300%) but still negligible (up to 0.7 pixel displacement))
    00065 *
    00066 */
    00067 //!@}
    00068
    00069 /**
    00070 * Matrix describing transformation from neck joint to camera.
    00071 */
    00072 class CameraInfo : public Streamable
    00073 {
    00074 public:
    00075   /**
    00076   * Default constructor.
    00077   * Sets the parameters for the ERS-7.
    00078   */
    00079   CameraInfo();
    00080
    00081   virtual void serialize( In* in, Out* out)
    00082   {
    00083     STREAM_REGISTER_BEGIN();
    00084     STREAM( resolutionWidth);
    00085     STREAM( resolutionHeight);
    00086     STREAM( openingAngleWidth);
    00087     STREAM( openingAngleHeight);
    00088     STREAM( focalLength);
    00089     STREAM( focalLengthMM);
    00090     STREAM( pixelPerMM);
    00091     STREAM( opticalCenter);
    00092     STREAM( secondOrderRadialDistortion);
    00093     STREAM( fourthOrderRadialDistortion);
    00094     STREAM( focalLenPow2);
    00095     STREAM( focalLenPow4);
    00096     STREAM( simulated);
    00097     focalLengthInv = 1.0/focalLength;
    00098     STREAM_REGISTER_FINISH();
    00099   }
    00100
    00101   /**
    00102   * Constructor.
    00103   * @param robotDesign Selects the robot the camera info is initialized for.
    00104   */
    00105   CameraInfo(RobotDesign::Design robotDesign);
    00106
    00107   int resolutionWidth;
    00108   int resolutionHeight;
    00109   double openingAngleWidth;
    00110   double openingAngleHeight;
    00111
    00112   /** Intrinsic camera parameters: axis skew is modelled as 0 (90° perfectly orthogonal XY)
    00113   * and the same has been modeled for focal axis aspect ratio; distortion is considering
    00114   * only 2nd and 4th order coefficients of radial model, which account for about 95% of total.
    00115   */
    00116   double focalLength;
    00117   double focalLengthInv; // (1/focalLength) used to speed up certain calculations
    00118   double focalLengthMM;  // Focal length in millimeters
    00119   double pixelPerMM;     // Number of pixels per MM on the CMOS part
    00120   Vector2<double> opticalCenter;
    00121   double secondOrderRadialDistortion;
    00122   double fourthOrderRadialDistortion;
    00123   double focalLenPow2;
    00124   double focalLenPow4;
    00125
    00126   /** Was the image generated by the simulator? */
    00127   bool simulated;
    00128 };
    00129
    00130 /**
    00131 * Streaming operator that reads a CameraInfo from a stream.
    00132 * @param stream The stream from which is read.
    00133 * @param cameraInfo The CameraInfo object.
    00134 * @return The stream.
    00135 */
    00136 //In& operator>>(In& stream,CameraInfo& cameraInfo);
    00137
    00138 /**
    00139 * Streaming operator that writes a CameraInfo to a stream.
    00140 * @param stream The stream to write on.
    00141 * @param cameraInfo The CameraInfo object.
    00142 * @return The stream.
    00143 */
    00144 //Out& operator<<(Out& stream, const CameraInfo& cameraInfo);
    00145
    00146 #endif //__CameraInfo_h_