如何创建一个鸟眼图像到给定的飞机? [英] How to create a Bird-Eye-View of image to a given plane?
问题描述
warpPerspective()
,这会做的工作吗? 我使用OpenCV:2.4.9
更新:
我必须计算4分,相机朝向法线,然后从鸟瞰图将它们传递给 findHomography()
以获取转换矩阵?
更新:
解决。
世界平面上的矩形将在图像中显示为四边形。
在鸟瞰视图中,您希望它再次显示为矩形。
您必须至少知道这个世界矩形的纵横比,才能使顶视图沿两个轴正确并均匀地缩放。
由于您的图片中有4个四边形2D点和目标矩形角(您基本上可以选择2D坐标),因此您可以计算从您的四边形到矩形的单应性,并使用 warpPerspective()
来渲染。
方式做到。
您还可以浏览相机和矩阵本身。为此,你需要旋转相机在平面上的正投影。请参阅单元格分解此处。
I'm given a plane (support vector and plane's normal vector), an image which was taken by a camera of which i know the intrinsic parameters (fx,fy,cx,cy). How do i obtain the transformation of this image to a bird-eye-view like image (so that birds view is collinear to the plane's normal vector). I'm confused with the coordinate systems i have to use, some matrices are in world coordinates and some in local. I know that there is warpPerspective()
in OpenCV, would this do the job?
Im using OpenCV: 2.4.9
Thanks alot!
Update:
Do I have to calculate 4 points with the camera facing normal, then 4 points from the bird eye view and pass them to findHomography()
to obtain the transformation matrix?
Update: Solved. Got it to work!
A rectangle on the world plane will appear as a quadrangle in your image.
In a bird's eye view, you want it to appear as a rectangle again.
You must know at least the aspect ratio of this world rectangle for the top view to be correctly and equally scaled along both axes.
Given the 4 quadrangle 2D points in your image, and the destination rectangle corners (for which you essentially choose the 2D coordinates) you can calculate the homography from your quadrangle to a rectangle and use warpPerspective()
to render it.
This is often the easiest way to do it.
You can also go through the camera and matrices themselves. For this you will need to rotate the camera to be above the plane with orthographic projection. See the homography decomposition here.
这篇关于如何创建一个鸟眼图像到给定的飞机?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!