Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef __mitkUndistortCameraImage_h
00019 #define __mitkUndistortCameraImage_h
00020
00021 #include "mitkConfig.h"
00022 #include "mitkCommon.h"
00023 #include <mitkOpenCVVideoSupportExports.h>
00024 #include "itkObject.h"
00025 #include "itkObjectFactory.h"
00026
00027 #include "mitkVector.h"
00028 #include "cv.h"
00029
00045 namespace mitk
00046 {
00047
00048 class MITK_OPENCVVIDEOSUPPORT_EXPORT UndistortCameraImage : public itk::Object
00049 {
00050 public:
00051
00052 mitkClassMacro(UndistortCameraImage,itk::Object);
00053 itkNewMacro(Self);
00054
00056
00057
00058
00059 void SetFocalLength(float fc_x, float fc_y)
00060 {
00061 m_fcX = fc_x; m_fcY = fc_y;
00062 }
00063
00064
00065
00066 void SetPrincipalPoint(float cc_x, float cc_y)
00067 {
00068 m_ccX = cc_x; m_ccY = cc_y;
00069 }
00070
00071
00072
00073 void SetCameraDistortion(float kc1, float kc2, float kc3, float kc4)
00074 {
00075 m_distortionMatrixData[0] = kc1; m_distortionMatrixData[1] = kc2;
00076 m_distortionMatrixData[2] = kc3; m_distortionMatrixData[3] = kc4;
00077 }
00078
00079
00080
00081 void InitRemapUndistortion(int sizeX, int sizeY);
00082
00084
00085
00086
00087 mitk::Point2D UndistortPixel(mitk::Point2D src);
00088
00089
00090
00091 void UndistortImage(IplImage* src, IplImage* dst);
00092
00093
00094
00095
00096
00097
00098
00099 void UndistortImageFast( IplImage * src, IplImage* dst = NULL );
00100 void SetUndistortImageFastInfo(float in_dF1, float in_dF2,
00101 float in_dPrincipalX, float in_dPrincipalY,
00102 float in_Dist[4], float ImageSizeX, float ImageSizeY);
00103
00104 UndistortCameraImage();
00105 virtual ~UndistortCameraImage();
00106
00107 protected:
00108
00109
00110 float m_ccX, m_ccY, m_fcX, m_fcY;
00111
00112 float m_distortionMatrixData[4];
00113
00114 float m_intrinsicMatrixData[9];
00115
00116 CvMat * m_mapX, * m_mapY;
00117
00118 CvMat m_intrinsicMatrix, m_distortionMatrix;
00119
00120 IplImage * m_tempImage;
00121
00122
00123
00124 CvMat *m_DistortionCoeffs;
00125 CvMat *m_CameraMatrix;
00126 };
00127
00128 }
00129
00130 #endif