Ask Your Question

Revision history [back]

Compute stereo remapped points without applying cv::remap to whole image.

I can compute the same feature's coordinate in left and right stereo image ,please suggest a faster way to compute these points in location in stereo calibrated image without applying cv::remap to whole image.

The initUndistortRectifyMap function in opencv results in maap in x and y direction that contains the coordinates of the undistorted pixel it computes these maps based on intrinsic camera matrix ,distortion matrix and rotation matrix.

initUndistortRectifyMap(cam1,dst1,R1,P1, imageSize, CV_16SC2, map1x,map1y);

cam1 (intrinsic camera matrix) dst1 (distortion coefficients) R1 (Rotation Matrix) map1x (new map of size of the image to denote where the shifted x coordinate lies in undistorted image) map2x ((new map of size of the image to denote where the shifted y coordinate lies in undistorted image) So if new the image coordinates in distorted image (xdistort,ydistort) the undistorted can be computed using

x_undistort = map1x.at<short>(ydistort,xdistort);
y_undistort = map2x.at<short>(ydistort,xdistort);

I checked the corresponding points in undistorted image they donot result in the same point. I checked the value of map1x at (0,0) and it contains negative value and when I click on console to find the coordinate value it gives the corresponding result from (0:im_width,0:imheight) . Is there any normalization procedure ? How to compute points directly without processing the whole image .