00001
00002
00003
00004
00005
00006
00007 #ifndef INVERSEPERSPECTIVEMAPPING_HH_
00008 #define INVERSEPERSPECTIVEMAPPING_HH_
00009
00010
00011 #include "cv.h"
00012 #include "mcv.hh"
00013 #include <list>
00014
00015
00016 #include "CameraInfoOpt.h"
00017
00018 using namespace std;
00019
00020 namespace LaneDetector
00021 {
00022
00026 typedef struct IPMInfo
00027 {
00029 FLOAT xLimits[2];
00031 FLOAT yLimits[2];
00034 FLOAT xScale;
00037 FLOAT yScale;
00039 int width;
00041 int height;
00044 float vpPortion;
00046 float ipmLeft;
00048 float ipmRight;
00050 float ipmTop;
00052 float ipmBottom;
00054 int ipmInterpolation;
00055 }IPMInfo;
00056
00058 typedef struct CameraInfo
00059 {
00061 FLOAT_POINT2D focalLength;
00063 FLOAT_POINT2D opticalCenter;
00065 FLOAT cameraHeight;
00067 FLOAT pitch;
00069 FLOAT yaw;
00071 FLOAT imageWidth;
00073 FLOAT imageHeight;
00074 }CameraInfo;
00075
00076
00077
00078
00079
00080
00081
00093 void mcvGetIPM(const CvMat* inImage, CvMat* outImage,
00094 IPMInfo *ipmInfo, const CameraInfo *cameraInfo,
00095 list<CvPoint>* outPoints=NULL);
00096
00097
00108 void mcvTransformImage2Ground(const CvMat *inPoints,
00109 CvMat *outPoints, const CameraInfo *cameraInfo);
00110
00111
00121 void mcvTransformGround2Image(const CvMat *inPoints,
00122 CvMat *outPoints, const CameraInfo *cameraInfo);
00123
00135 FLOAT_POINT2D mcvGetVanishingPoint(const CameraInfo *cameraInfo);
00136
00144 void mcvPointImIPM2World(FLOAT_POINT2D *point, const IPMInfo *ipmInfo);
00145
00153 void mcvInitCameraInfo (char *const fileName, CameraInfo *cameraInfo);
00154
00162 void mcvScaleCameraInfo (CameraInfo *cameraInfo, CvSize size);
00163
00172 void mcvGetIPMExtent(const CameraInfo *cameraInfo, IPMInfo *ipmInfo);
00173
00182 void mcvTransformImIPM2Ground(const CvMat *inMat, CvMat* outMat,
00183 const IPMInfo *ipmInfo);
00184
00194 void mcvTransformImIPM2Im(const CvMat *inMat, CvMat* outMat,
00195 const IPMInfo *ipmInfo,
00196 const CameraInfo *cameraInfo);
00197
00198 }
00199
00200 #endif