使用OpenCV校正立体图像
我打算制作一个程序,该程序将拍摄由单个相机拍摄的立体对图像,然后对其进行校正和裁剪,以便当使用平行或交叉眼方法并排观看图像时,将实现最佳的3D效果。左图将作为参考图像,右图将进行修改以进行校正。我相信 OpenCV 将是实现这些目的的最佳软件。到目前为止,我相信处理会发生这样的事情:
- 纠正图像之间的旋转。
- 修正 y 轴偏移。
这样做会导致右图像上方和下方出现不规则的黑色边框,因此:
- 将两个图像裁剪到相同的高度以删除边框。
- 计算立体对应/视差
- 计算最佳视差
- 校正图像以实现最佳视差
好吧,这就是我对需要做的事情及其发生顺序的看法,我要问的是,这看起来对吗?我错过了什么吗另外,我需要使用 OpenCV 的哪些特定功能来完成该项目的所有必要步骤?或者 OpenCV 不是正确的选择?非常感谢。
I intend to make a program which will take stereo pair images, taken by a single camera, and then correct and crop them so that when the images are viewed side by side with the parallel or cross eye method, the best 3D effect will be achieved. The left image will be the reference image, the right image will be modified for corrections. I believe OpenCV will be the best software for these purposes. So far I believe the processing will occur something like this:
- Correct for rotation between images.
- Correct for y axis shift.
Doing so will I imagine result in irregular black borders above and below the right image so:
- Crop both images to the same height to remove borders.
- Compute stereo-correspondence/disparity
- Compute optimal disparity
- Correct images for optimal disparity
Okay, so that's my take on what needs doing and the order it occurs in, what I'm asking is, does that seem right, is there anything I've missed, anything in the wrong order etc. Also, which specific functions of OpenCV would I need to use for all the necessary steps to complete this project? Or is OpenCV not the way to go? Much thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
OpenCV 非常适合这个。
有一整章:
本书中的所有示例代码都随 opencv 发行版一起提供
编辑:大致步骤是:
重新映射每个图像以消除镜头扭曲并将视图旋转/平移到图像中心。
裁剪不在两个视图中出现的像素(可选)
在每个视图中查找匹配对象(立体块匹配)创建视差图< /p>
将视差图重新投影到 3D 模型中
OpenCV is great for this.
There is a whole chapter in:
And all the sample code for this in the book ships with the opencv distribution
edit: Roughly the steps are:
Remap each image to remove lens distortions and rotate/translate views to image center.
Crop pixels that don't appear in both views (optional)
Find matching objects in each view (stereoblock matching) create disparity map
Reproject disparity map into 3D model