如何将相机坐标转换为世界坐标使用OpenCV

发布于 2025-01-23 10:58:44 字数 663 浏览 0 评论 0原文

示意图图片

使用OpenCV slovepnp func Input world sopto world coortion socoration

R = np.array([[-0.0813445156856268], [-2.5478950926311636], [1.7376856594745234]], dtype=np.float32)
T = np.array([[10.838262901867047], [-6.506593974297687], [60.308121310607724]], dtype=np.float32)

coortiat已经测量了

世界坐标系统点 - >相机坐标系点

0, 0 ,0 -> [11.052, -6.596, 60.9]

13, 0, 0 -> [-2.142, -5.628, 61.3]

13, 0, 13.5 -> [-2.668, -17.547, 56.2]  : possible Error 2 cm

如何使用R,T向量转换为世界坐标系?

schematic diagram picture

use opencv slovePNP func input world coordinate four point get R and T

R = np.array([[-0.0813445156856268], [-2.5478950926311636], [1.7376856594745234]], dtype=np.float32)
T = np.array([[10.838262901867047], [-6.506593974297687], [60.308121310607724]], dtype=np.float32)

The following corresponding data have been measured

World coordinate system point -> camera coordinate system point

0, 0 ,0 -> [11.052, -6.596, 60.9]

13, 0, 0 -> [-2.142, -5.628, 61.3]

13, 0, 13.5 -> [-2.668, -17.547, 56.2]  : possible Error 2 cm

How do I convert the camera coordinate system to the world coordinate system using R,T vector?

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

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

发布评论

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

评论(1

蓝天白云 2025-01-30 10:58:44

我找到了转换公式

R = np.array([[-0.0813445156856268], [-2.5478950926311636], [1.7376856594745234]], dtype=np.float32)
T = np.array([[10.838262901867047], [-6.506593974297687], [60.308121310607724]], dtype=np.float32)

world_point = [13, 0, 0]

rvec_matrix = cv2.Rodrigues(R)[0]
rmat = np.matrix(rvec_matrix)
tmat = np.matrix(T)
pmat = np.matrix(np.array([[world_point[0]], [world_point[1]], [world_point[]2]], dtype=np.float32))

# world coordinate to camera coordinate
cam_point = rmat * pmat + tmat
print(cam_point)

# camera coordinate to world coordinate
world_point = rmat ** -1 * (cam_point - tmat)

I have found the conversion formula

R = np.array([[-0.0813445156856268], [-2.5478950926311636], [1.7376856594745234]], dtype=np.float32)
T = np.array([[10.838262901867047], [-6.506593974297687], [60.308121310607724]], dtype=np.float32)

world_point = [13, 0, 0]

rvec_matrix = cv2.Rodrigues(R)[0]
rmat = np.matrix(rvec_matrix)
tmat = np.matrix(T)
pmat = np.matrix(np.array([[world_point[0]], [world_point[1]], [world_point[]2]], dtype=np.float32))

# world coordinate to camera coordinate
cam_point = rmat * pmat + tmat
print(cam_point)

# camera coordinate to world coordinate
world_point = rmat ** -1 * (cam_point - tmat)

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