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

Representations/Perception/CameraInfo.cpp

Go to the documentation of this file.
00001 /**
00002 * @file CameraInfo.cpp
00003 *
00004 * Implementation 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 #include "CameraInfo.h"
00011 
00012 CameraInfo::CameraInfo() : 
00013 resolutionWidth(cameraResolutionWidth_ERS7),
00014 resolutionHeight(cameraResolutionHeight_ERS7),
00015 openingAngleWidth(openingAngleWidth_ERS7),
00016 openingAngleHeight(openingAngleHeight_ERS7),
00017 focalLength(focalLength_ERS7),
00018 opticalCenter(opticalCenterX_ERS7, opticalCenterY_ERS7),
00019 secondOrderRadialDistortion(secondOrderRadialDistortion_ERS7),
00020 fourthOrderRadialDistortion(fourthOrderRadialDistortion_ERS7),
00021 focalLenPow2(focalLength*focalLength),
00022 focalLenPow4(focalLength*focalLength*focalLength*focalLength),
00023 focalLengthInv(1.0/focalLength),
00024 simulated(false)
00025 {
00026 } 
00027 
00028 CameraInfo::CameraInfo(RobotDesign::Design robotDesign) : 
00029 resolutionWidth(robotDesign == RobotDesign::ERS210 ? cameraResolutionWidth_ERS210 : cameraResolutionWidth_ERS7),
00030 resolutionHeight(robotDesign == RobotDesign::ERS210 ? cameraResolutionHeight_ERS210 : cameraResolutionHeight_ERS7),
00031 openingAngleWidth(robotDesign == RobotDesign::ERS210 ? openingAngleWidth_ERS210 : openingAngleWidth_ERS7),
00032 openingAngleHeight(robotDesign == RobotDesign::ERS210 ? openingAngleHeight_ERS210 : openingAngleHeight_ERS7),
00033 focalLength(robotDesign == RobotDesign::ERS210 ? focalLength_ERS210 : focalLength_ERS7),
00034 opticalCenter(robotDesign == RobotDesign::ERS210 ? opticalCenterX_ERS210 : opticalCenterX_ERS7, 
00035                   robotDesign == RobotDesign::ERS210 ? opticalCenterY_ERS210 : opticalCenterY_ERS7),
00036 secondOrderRadialDistortion(robotDesign == RobotDesign::ERS210 ? secondOrderRadialDistortion_ERS210 : secondOrderRadialDistortion_ERS7),
00037 fourthOrderRadialDistortion(robotDesign == RobotDesign::ERS210 ? fourthOrderRadialDistortion_ERS210 : fourthOrderRadialDistortion_ERS7),
00038 focalLenPow2(focalLength*focalLength),
00039 focalLenPow4(focalLength*focalLength*focalLength*focalLength),
00040 focalLengthInv(1.0/focalLength),
00041 simulated(false)
00042 {
00043 } 
00044 
00045 In& operator>>(In& stream,CameraInfo& cameraInfo)
00046 {
00047   char c;
00048   stream >> cameraInfo.resolutionWidth;
00049   stream >> cameraInfo.resolutionHeight;
00050   stream >> cameraInfo.openingAngleWidth;
00051   stream >> cameraInfo.openingAngleHeight;
00052   stream >> cameraInfo.focalLength;
00053   stream >> cameraInfo.opticalCenter;
00054   stream >> cameraInfo.secondOrderRadialDistortion;
00055   stream >> cameraInfo.fourthOrderRadialDistortion;
00056   stream >> cameraInfo.focalLenPow2;
00057   stream >> cameraInfo.focalLenPow4;
00058   stream >> c;
00059   cameraInfo.simulated = c != 0;
00060   cameraInfo.focalLengthInv = 1.0/cameraInfo.focalLength;
00061   return stream;
00062 }
00063 
00064 Out& operator<<(Out& stream, const CameraInfo& cameraInfo)
00065 {
00066   stream << cameraInfo.resolutionWidth;
00067   stream << cameraInfo.resolutionHeight;
00068   stream << cameraInfo.openingAngleWidth;
00069   stream << cameraInfo.openingAngleHeight;
00070   stream << cameraInfo.focalLength;
00071   stream << cameraInfo.opticalCenter;
00072   stream << cameraInfo.secondOrderRadialDistortion;
00073   stream << cameraInfo.fourthOrderRadialDistortion;
00074   stream << cameraInfo.focalLenPow2;
00075   stream << cameraInfo.focalLenPow4;
00076   stream << (char) cameraInfo.simulated;
00077   return stream;
00078 }
00079 
00080 /*
00081 * Change log :
00082 * 
00083 * $Log: CameraInfo.cpp,v $
00084 * Revision 1.3  2004/06/14 20:12:10  jhoffman
00085 * - numerous changes and additions to headcontrol
00086 * - cameraInfo default constructor now creates ERS7 info
00087 * - debug drawing "headcontrolfield" added
00088 *
00089 * Revision 1.2  2004/05/26 14:06:32  roefer
00090 * Corrected initialization of addition y channels in default constructor
00091 * Flag for simulated images added
00092 *
00093 * Revision 1.1.1.1  2004/05/22 17:25:32  cvsadm
00094 * created new repository GT2004_WM
00095 *
00096 * Revision 1.4  2004/03/09 11:32:08  nistico
00097 * - Intrinsic parameters based measurements can now be triggered through a single conditional compilation
00098 * switch located in CameraInfo.h
00099 * - Implemented fast (look-up table based) radial distortion correction
00100 *
00101 * Revision 1.3  2004/02/10 10:48:05  nistico
00102 * Introduced Intrinsic camera parameters to perform geometric calculations (distance, angle, size...) without opening angle
00103 * Implemented radial distortion correction function
00104 * Implemented ball distance calculation based on size and intrinsic params (potentially more stable)
00105 * To Be Done: calculate intrinsic params for ERS7, as soon as we get our puppies back
00106 *
00107 * Revision 1.2  2004/01/23 00:10:02  roefer
00108 * New constructor added, opening angles from Sony
00109 *
00110 * Revision 1.1  2003/12/15 11:13:15  juengel
00111 * Introduced CameraInfo
00112 *
00113 */

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