相机校准

发布于 2024-09-16 19:46:23 字数 101 浏览 2 评论 0原文

我正在使用 OpenCV,这是整个事情的新手。

我有一个场景,我正在投影在墙上,我正在构建一种带有摄像头的机器人。我想知道如何处理图像,以便获得相机跟踪的斑点坐标的真实值?

I am using OpenCV, a newbie to the entire thing.

I have a scenario, I am projecting on a wall, I am building a kind of a robot which has a camera. I wanted to know how can I process the image so that I could get the real-world values of the co-ordinates of the blobs tracked by my camera?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

深爱成瘾 2024-09-23 19:46:23

首先,您需要对相机进行内部校准。使用印刷在纸板上的棋盘图案来做到这一点,OpenCV 有实现此目的的方法,尽管也有完成此目的的工具。
为了得到一个想法,我编写了一些 python 代码来从实时视频流进行校准,沿着相机以不同的角度和距离移动纸板。看一下这里: ​​http://svn.ioctl.eu/pub/opencv/py -camera_intrinsic/

然后需要校准相机的外部,即相机的位置。你的世界坐标。您可以在墙上放置一些标记,定义这些标记的 3D 位置,并让 OpenCV 为此校准外部 (cvFindExtrinsicCameraParams2)。
在我的示例代码中,我计算了外部 wrt。棋盘,这样我就可以以相机的正确视角渲染茶壶。您必须根据您的需要进行调整。

我假设您仅投影到平坦的表面上。您必须了解几何形状才能获取检测到的斑点的 3D 坐标。然后,您可以在相机图像中找到斑点,并了解内在、外在和几何形状,您可以根据内在/外在从相机中为每个斑点投射光线,并计算每条此类光线与已知几何形状的交集。交点就是世界空间中斑点投影到的 3D 点。

First of all, you need to calibrate the intrinsic of the camera. Use checkerboard-patterns printed on cardboard to do this, OpenCV has methods for this although there are finished tools for this as well.
To get an idea, I have written some python code to calibrate from a live video stream, move the cardboard along the camera in some different angles and distances. Take a look here: http://svn.ioctl.eu/pub/opencv/py-camera_intrinsic/

Then you need to calibrate the extrinsic of the camera, that is the position of the camera wrt. your world coordinates. You can place some markers on the wall, define the 3D-position of those markers and let OpenCV calibrate the extrinsic for this (cvFindExtrinsicCameraParams2).
In my sample code, I calculate the extrinsic wrt. the checkerboard so I can render a Teapot in the correct perspective of the camera. You have to adjust this to your needs.

I assume you project only onto a flat surface. You have to know the geometry to get the 3D coordinates of your detected blob. You can then find the blobs in your camera image and knowing intrinsic, extrinsic and the geometry, you can cast rays for each blob from the camera according to your intrinsic/extrinsic and calculate the intersection of each such ray with your known geometry. The intersection then is your 3D point in world space where the blob is projected to.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文