Here we're gonna learn how the point in the world coordinate is mapped to the point in the camera coordinate.
Global steps
1) World coordinate to camera coordinate by extrinsic parameters (rotation & translation)
where tilde means inhomogenous coordinates.
2) Mapping the camera coordinate to the image plane
3) Complement for lens distortions
3) Obtain accurate point using intrinsic parameters
Three kinds of camera distortion (Barrel, Pincusion, Mustache) has been widely considered.
Genearlly, since people already implemented the mathematical model of camera distortion in OpenCV, we could just use them!
cv::initUndistortRectifyMap(K, k, cv::Matx33f::eye(), K, frameSize, CV_32FC1,mapX, mapY);