00001
00002
00003
00004
00005
00006
00007
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
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113