相机位置在世界坐标从cv :: solvePnP [英] Camera position in world coordinate from cv::solvePnP

查看:5756
本文介绍了相机位置在世界坐标从cv :: solvePnP的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个校准的相机(固有矩阵和失真系数),我想知道相机的位置知道一些3d点和它们的图像中的对应点(2d点)。

I have a calibrated camera (intrinsic matrix and distortion coefficients) and I want to know the camera position knowing some 3d points and their corresponding points in the image (2d points).

我知道 cv :: solvePnP 可以帮助我,在阅读这个我知道solvePnP rvec tvec 的输出是旋转

I know that cv::solvePnP could help me, and after reading this and this I understand that I the outputs of solvePnP rvec and tvec are the rotation and translation of the object in camera coordinate system.

因此,我需要在世界坐标系中找出相机的旋转/平移。

So I need to find out the camera rotation/translation in the world coordinate system.

从上面的链接,似乎代码很简单,在python:

From the links above it seems that the code is straightforward, in python:

found,rvec,tvec = cv2.solvePnP(object_3d_points, object_2d_points, camera_matrix, dist_coefs)
rotM = cv2.Rodrigues(rvec)[0]
cameraPosition = -np.matrix(rotM).T * np.matrix(tvec)

我不知道python / numpy东西(我使用C ++)对我很有意义:

I don't know python/numpy stuffs (I'm using C++) but this does not make a lot of sense to me:

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