图像坐标到世界坐标opencv [英] image coordinate to world coordinate opencv

查看:272
本文介绍了图像坐标到世界坐标opencv的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用opencv校准了我的单反相机.现在,我知道了相机的相机固有矩阵和失真系数[K1,K2,P1,P2,K3,K4,K5,K6].假设摄像机以[Roll,Pitch,Yaw]旋转放置在[x,y,z]中.当相机在地板[z = 0]上观看时,如何获得世界坐标中的每个像素.

I calibrated my mono camera using opencv. Now I know the camera intrinsic matrix and distortion coefs [K1, K2, P1 ,P2,K3 ,K4, K5, K6] of my camera. Assuming that camera is place in [x, y, z] with [Roll, Pitch, Yaw] rotations. how can I get each pixel in world coordinate when the camera is looking on the floor [z=0].

推荐答案

您说您校准了相机,这给了您:

You say that you calibrated your camera which gives you:

  • 内在参数
  • 外部参数(旋转,平移)
  • 失真系数

首先,要补偿变形,您可以使用取消注册函数并获得未失真的图像.现在,剩下的就是内部/外部参数和针孔相机模型.下面的等式摘自 OpenCV文档说明了如何转换3D世界使用这些参数将坐标转换为2D图像坐标:

First, to compensate for the distortion, you can use the undistort function and get an undistorted image. Now, what you are left with is the intrinsic/extrinsic parameters and the pinhole camera model. The equation below taken from the OpenCV documentation explains how to transform 3D world coordinates into 2D image coordinates using those parameters:

基本上,您可以将3D坐标乘以投影矩阵,而投影矩阵又是内部参数(方程式中的第一个矩阵)和外部参数(方程式中的第二个矩阵)的组合.外在参数矩阵包含旋转和平移分量[R|T].

Basically, you multiply the 3D coordinates by a projection matrix, which in turn is a combination of the intrinsic parameters (the first matrix in the equation) and the extrinsic parameters (the second matrix in the equation). The extrinsic parameters matrix contains both rotation and translation components [R|T].

这篇关于图像坐标到世界坐标opencv的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆