1 year ago

#224417

test-img

yctsaiiiii

Camera calibration rectify ROI instead of complete picture

I am working on a stereo vision project. My goal is to locate the 3D-coordinate of a point on a target that marked by a laser point.

I do the stereo calibration with full size pictures. After getting the parameters, "initUndistortRectifyMap" is applied to get the mapping data "map1" and "map2".

cv.initUndistortRectifyMap( cameraMatrix, distCoeffs, R, newCameraMatrix, size, m1type[, map1[, map2]] ) -> map1, map2

Since my target is just a small area and I would like to increase my acquiring fps, My cameras acquire the ROI instead of full size pictures.

Here comes my problem. Can I just map the ROI of an image instead of full picture? It is easy to map the same size picture as map1 and map2 with remap function, however, how can I just map the ROI of the picture.

cv.remap( src, map1, map2, interpolation[, dst[, borderMode[, borderValue]]] ) -> dst

Note, I try to crop the ROI of the "map1" and "map2" but it is not simply mapping pixels from source picture to destination picture. According to https://stackoverflow.com/a/34265822/18306909, I can not directly use map_x and map_y to get the destination of ROI.

As stated in the docs you refer to, it is dst(x, y) = src(map_x(x, y), map_y(x, y)). Transforming points dst -> src is easy (lookup in map_x and map_y), but the OP wants the other (more natural) direction: src -> dst. This is admittingly confusing because cv::remap works "inversely" (for numerical stability reasons). I.e., in order to map an image src -> dst, you supply a mapping from dst -> src. Unfortunately, that's only efficient when transforming many points on a regular grid (i.e. image). Transforming a single random point is pretty difficult. – pasbi Feb 24, 2021 at 10:17

python

opencv

image-processing

stereo-3d

remap

0 Answers

Your Answer

Accepted video resources