59 void CUndistortionSimple::CUndistortionMapper::Init(
int width,
int height,
float d)
62 this->cx = 0.5f * float(width - 1);
63 this->cy = 0.5f * float(height - 1);
65 ComputeMap(width, height);
68 void CUndistortionSimple::CUndistortionMapper::ComputeOriginalCoordinates(
const Vec2d &newCoordinates,
Vec2d &originalCoordinates)
71 const float x = newCoordinates.
x - cx;
72 const float y = newCoordinates.
y - cy;
74 const float rr = x * x + y * y;
75 const float factor = 1.0f + d * rr;
77 originalCoordinates.
x = cx + factor * x;
78 originalCoordinates.
y = cy + factor * y;
90 this->height = height;
92 m_pUndistortionMapper =
new CUndistortionMapper(bInterpolate);
93 m_pUndistortionMapper->Init(width, height, d);
98 delete m_pUndistortionMapper;
108 m_pUndistortionMapper->PerformMapping(pInputImage, pOutputImage);
Data structure for the representation of a 2D vector.
void Undistort(const CByteImage *pInputImage, CByteImage *pOutputImage)
CUndistortionSimple(int width, int height, float d, bool bInterpolate=true)
Data structure for the representation of 8-bit grayscale images and 24-bit RGB (or HSV) color images ...