Ask Your Question

Revision history [back]

@cmdkeen is correct regarding the inverse mapping. According to the documentation of initUndistortRectifyMap(), I qoute:

The function actually builds the maps for the inverse mapping algorithm that is used by remap. That is, for each pixel (u,v) in the destination (corrected and rectified) image, the function computes the corresponding coordinates in the source image (that is, in the original image from camera). The following process is applied: ...

Essentially it's a f(undistorted) = distorted map (source).

x_distorted = map1.at<float>(y_rect,x_rect);
y_distorted = map2.at<float>(y_rect,x_rect);

For single coordinate conversion, if you don't care about the speed, you may want to try undistortPoints() function. Or you can always pre-built your own map with the function and stores it for later usage.