OpenCV手眼标定(Python版)

本文介绍了使用OpenCV的calibrateHandEye()函数进行手眼标定的方法,包括眼在手上的情况和眼在手外的情况。在眼在手上时,camera_to_end为定值;在眼在手外时,camera_to_base为定值。还提供了眼在手外的示例代码,并提到了虚拟数据的使用。此外,文章提及了3D视觉工坊的截图作为辅助理解,并推荐了其他博主的机械臂手眼标定资源。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

一、标定函数

利用opencv中的calibrateHandEye()函数进行标定,函数包含多个参数如下所示。其中gripper就是end,target就是board。

cv2.calibrateHandEye(R_gripper2base: Any,
                     t_gripper2base: Any,
                     R_target2cam: Any,
                     t_target2cam: Any,
                     R_cam2gripper: Any = None,
                     t_cam2gripper: Any = None,
                     method: Any = None)

二、眼在手上

相机安装在机械臂末端时,camera_to_end是一个定值(待求值),函数参数对应关系如下。

"""
R_gripper2base : R_end_to_base 
T_gripper2base : T_end_to_base  
R_target2camera : R_board_to_camera
T_target2camera : T_board_to_camera
R_cam2gripper : R_camera_to_end
T_cam2gripper : T_camera_to_end
"""

三、眼在手外

相机固定安装在外部时,camera_to_base是一个定值(待求值),函数参数对应关系如下。

"""
R_gripper2base : R_base_to_end 
T_gripper2base : T_base_to_end 
R_target2camera : R_board_to_camera
T_target2camera : T_board_to_camera
R_cam2gripper : R_camera_to_base
T_cam2gripper : T_camera_to_base
"""

四、眼在手外示例代码

通过虚拟的数据进行标定,其中M_target_to_camera需要通过solvepnp获得旋转平移矩阵,本示例省略该部分。详细内容看我的另一篇《相机标定》。

import cv2
import numpy as np

R_gripper2base = [np.mat([[0.6392664, -0.7427392, 0.1991911],
                          [0.761848, 0.6469268, -0.0327619],
                          [-0.1045285, 0.1726969, 0.9794129]]),
                  np.mat([[0.8571714, -0.4691177, 0.2125697],
                          [0.4948881, 0.8645198, -0.0877003],
                          [-0.1426289, 0.1803724, 0.9732023]]),
                  np.mat([[0.7621228, -0.6455822, -0.0489121],
                          [0.639497, 0.7388382, 0.2125128],
                          [-0.1010563
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值