相机校准校正 ROI 而不是完整图片
我正在研究一个立体视觉项目。我的目标是定位目标上由激光点标记的点的 3D 坐标。
我用全尺寸图片进行立体校准。获取参数后,应用“initUn DistortifyMap”获取映射数据“map1”和“map2”。
cv.initUn DistorifyMap(cameraMatrix, distCoeffs, R, newCameraMatrix, size, m1type[, map1[, map2]] ) -> map1,map2
由于我的目标只是一个小区域,并且我想增加获取 fps,因此我的相机获取 ROI 而不是全尺寸图片。
我的问题来了。 我可以只映射图像的 ROI 而不是完整图片吗? 使用remap功能映射与map1和map2相同大小的图片很容易,但是如何才能只映射图片的ROI呢?
cv.remap( src, map1, map2, interpolation[, dst[, borderMode[, borderValue]]] ) -> dst
注意,我尝试裁剪“map1”和“map2”的 ROI,但它并不是简单地将像素从源图片映射到目标图片。 根据https://stackoverflow.com/a/34265822/18306909,我不能直接使用map_x和map_y来获取ROI 的目的地。
正如您引用的文档中所述,它是 dst(x, y) = src(map_x(x, y), map_y(x, y))。变换点 dst -> src 很容易(在map_x 和map_y 中查找),但是OP 想要另一个(更自然的)方向: src ->目的地。这确实令人困惑,因为 cv::remap 的工作原理是“相反”的(出于数值稳定性的原因)。即为了映射一个图像src-> dst,您提供从 dst -> 的映射源代码。不幸的是,这只有在转换规则网格(即图像)上的许多点时才有效。变换单个随机点是相当困难的。 – pasbi 2021 年 2 月 24 日 10:17
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论