*
* This example explains how to use the hand eye calibration for the case where
* the camera is stationary with respect to the robot and the calibration
* object is attached to the robot arm.
*这个示例展示了如何使用手眼标定,这种情形用于相机与机械手基础坐标系位置固定且标定板固定在相机的末端轴上。
* In this case, the goal of the hand eye calibration
* is to determine two unknown poses:
*在这种情况下,手眼标定目标是确定一下两个位置姿态。
* - the pose of the robot base in the coordinate system
* of the camera (BaseInCamPose).
*基于相机坐标系的机械手基础坐标系姿态
* - the pose of the calibration object in the coordinate system of the
* tool (CalObjInToolPose)
*基于相机末端(工具)坐标系的标定板姿态
* Theoretically, as input the method needs at least 3 poses of the
* calibration object in the camera coordinate system and the corresponding
* poses of the robot tool in the coordinate system of the
* robot base. However it is recommended to use at least 10 Poses.
*理论上至少需要三个基于相机坐标系系统下标定物的姿态和基于机器人坐标系机器人末端工作坐标系的姿态。
*但建议至少使用10个姿态。
* The poses of the calibration object are obtained from images of the
* calibration object recorded with the stationary camera.
*标定板的姿态是从静止相机拍摄的标定板图像内获得的。
* The calibration object is moved by the robot with respect to the camera.
*标定板相对于相机由机器人移动。
* To obtain good calibration results, it its essential to position
* the calibration object with respect to the camera so that the object appears
* tilted in the image.
*为了获得良好的标定效果,标定物相对于相机其图像要倾斜(旋转)一些。
* After the hand eye calibration, the computed transformations are
* extracted and used to compute the pose of the calibration object in the
* camera coordinate system.
*在手眼标定后,提取计算出的变换矩阵用于计算在相机坐标系系统中计算标定对象的姿态。
dev_update_off ()
* Directories with calibration images and data files
*以下是图像和数据文件
ImageNameStart := '3d_machine_vision/handeye/stationarycam_calib3cm_'
DataNameStart := 'handeye/stationarycam_'
NumImages := 17
* Read image
read_image (Image, ImageNameStart + '00')
get_image_size (Image, Width, Height)
* Open window 打开窗口
dev_close_window ()
dev_open_window (0, 0, Width, Height, 'black', WindowHandle)
dev_set_line_width (2)
dev_set_draw ('margin')
dev_display (Image)
* Set font 设置字体
set_display_font (WindowHandle, 14, 'mono', 'true', 'false')
* Load the calibration plate description file.
* Make sure that the file is in the current directory,
* the HALCONROOT/calib directory, or use an absolut path
*加载标定板说明文件,确保文件在正确的目录内或使用绝对路径
CalTabFile := 'caltab_30mm.descr'
* Read the initial values for the internal camera parameters
*读取相机的内参
read_cam_par (DataNameStart + 'start_campar.dat', StartCamParam)
* Create the calibration model for the hand eye calibration
*创建一个标定模型用于手眼标定
create_calib_data ('hand_eye_stationary_cam', 1, 1, CalibDataID)
*给标定模板设置相机参数 面阵相机
set_calib_data_cam_param (CalibDataID, 0, 'area_scan_division', StartCamParam)
*给标定模板设置标定板文数据
set_calib_data_calib_object (CalibDataID, 0, CalTabFile)
*设置标定数据
*设置手眼校准过程中使用的优化方法。如果设置了dataValue='linear',则使用线性方法进行手眼校准。
*如果设置了dataValue='非线性',则将使用非线性方法进行手眼校准(有关详细信息,请参见校准手眼)。
set_calib_data (CalibDataID, 'model', 'general', 'optimization_method', 'nonlinear')
disp_message (WindowHandle, 'The calibration data model was created', 'window', 12, 12, 'black', 'true')
disp_continue_message (WindowHandle, 'black', 'true')
stop ()
* Start the loop over the calibration images 开始循环标定图像
for I := 0 to NumImages - 1 by 1
read_image (Image, ImageNameStart + I$'02d')
* Search for the calibration plate, extract the marks and the
* pose of it, and store the results in the calibration data model of the
* hand-eye calibration
*搜索标定板,提取标记和位置,并将结果存储在手眼标定的数据模板中
find_calib_object (Image, CalibDataID, 0, 0, I, [], [])
get_calib_data_observ_contours (Caltab, CalibDataID, 'caltab', 0, 0, I)
* get_calib_data_observ_contours (Caltab, CalibDataID, 'marks', 0, 0, I)
get_calib_data_observ_points (CalibDataID, 0, 0, I, RCoord, CCoord, Index, CalObjInCamPose)
* Visualize the extracted calibration marks and the estimated pose (coordinate system)
*显示提取到的标定mark点和估算姿态
dev_set_color ('green')
dev_display (Image)
dev_display (Caltab)
dev_set_color ('yellow')
disp_cross (WindowHandle, RCoord, CCoord, 6, 0)
dev_set_colored (3)
disp_3d_coord_system (WindowHandle, StartCamParam, CalObjInCamPose, 0.01)
* Read pose of tool in robot base coordinates (ToolInBasePose)
*在机械手基础坐标系中读取末端工具坐标系的姿态
read_pose (DataNameStart + 'robot_pose_' + I$'02d' + '.dat', ToolInBasePose)
* Set the pose tool in robot base coordinates in the calibration data model
*给标定数据模板设置基于机械手基础坐标系下的工具姿态
set_calib_data (CalibDataID, 'tool', I, 'tool_in_base_pose', ToolInBasePose)
* Uncomment to inspect visualization
* disp_message (WindowHandle, 'Extracting data from calibration image ' + (I + 1) + ' of ' + NumImages, 'window', -1, -1, 'black', 'true')
* disp_continue_message (WindowHandle, 'black', 'true')
* stop ()
endfor
disp_message (WindowHandle, 'All relevant data has been set in the calibration data model', 'window', 12, 12, 'black', 'true')
disp_continue_message (WindowHandle, 'black', 'true')
stop ()
* Perform hand-eye calibration 进行手眼标定
* Internally before performing the hand-eye calibration the cameras are calibrated
* and the calibrated poses of the calibration object in the camera are used.
*在进行手眼校准之前,对相机进行内部校准,并使用相机中校准对象的校准姿态。
dev_display (Image)
disp_message (WindowHandle, 'Performing the hand-eye calibration', 'window', 12, 12, 'black', 'true')
*进行手眼校准之前,得到优化的平均残差
calibrate_hand_eye (CalibDataID, Errors)
* Query the camera parameters and the poses 查询相机参数和姿势
get_calib_data (CalibDataID, 'camera', 0, 'params', CamParam)
* Get poses computed by the hand eye calibration 通过手眼标定计算出姿势
get_calib_data (CalibDataID, 'camera', 0, 'base_in_cam_pose', BaseInCamPose)
get_calib_data (CalibDataID, 'calib_obj', 0, 'obj_in_tool_pose', ObjInToolPose)
dev_get_preferences ('suppress_handled_exceptions_dlg', PreferenceValue)
dev_set_preferences ('suppress_handled_exceptions_dlg', 'true')
try
* Store the camera parameters to file 将相机参数存储到文件
write_cam_par (CamParam, DataNameStart + 'final_campar.dat')
* Save the hand eye calibration results to file 将手眼标定结果保存到文件
write_pose (BaseInCamPose, DataNameStart + 'final_pose_cam_base.dat')
write_pose (ObjInToolPose, DataNameStart + 'final_pose_tool_calplate.dat')
catch (Exception)
* Do nothing
endtry
dev_set_preferences ('suppress_handled_exceptions_dlg', PreferenceValue)
* Display calibration errors of the hand-eye calibration
Message := 'Quality of the results: root mean square maximum'
Message[1] := 'Translation part in meter: ' + Errors[0]$'6.4f' + ' ' + Errors[2]$'6.4f'
Message[2] := 'Rotation part in degree: ' + Errors[1]$'6.4f' + ' ' + Errors[3]$'6.4f'
disp_message (WindowHandle, Message, 'window', 12, 12, 'black', 'true')
disp_continue_message (WindowHandle, 'black', 'true')
stop ()
* For the given camera, get the corresponding pose indices and calibration object indices
*对于给定的相机,获取相应的姿态指数和标定对象指数。
query_calib_data_observ_indices (CalibDataID, 'camera', 0, CalibObjIdx, PoseIds)
* Compute the pose of the calibration object in the camera coordinate
* system via calibrated poses and the ToolInBasePose and visualize it.
*通过标定姿态和工具基本姿态计算相机坐标系中校准对象的姿态,并将其可视化。
for I := 0 to NumImages - 1 by 1
read_image (Image, ImageNameStart + I$'02d')
* Obtain the pose of the tool in robot base coordinates used in the calibration.
* The index corresponds to the index of the pose of the observation object.
*在校准中使用的机器人基础坐标中获取工具的姿态。
*该索引对应于观测对象姿态的索引。
get_calib_data (CalibDataID, 'tool', PoseIds[I], 'tool_in_base_pose', ToolInBasePose)
dev_display (Image)
* Compute the pose of the calibration plate with respect to the camera and visualize it
* 计算校准板相对于摄像机的姿态并将其可视化
calc_calplate_pose_stationarycam (ObjInToolPose, BaseInCamPose, ToolInBasePose, CalObjInCamPose)
dev_set_colored (3)
disp_3d_coord_system (WindowHandle, CamParam, CalObjInCamPose, 0.01)
Message := 'Using the calibration results to display the'
Message[1] := 'coordinate system in image ' + (I + 1) + ' of ' + NumImages
disp_message (WindowHandle, Message, 'window', 12, 12, 'black', 'true')
if (I < NumImages - 1)
disp_continue_message (WindowHandle, 'black', 'true')
stop ()
endif
endfor
* Clear the data model
clear_calib_data (CalibDataID)
*
* After the hand-eye calibration the computed pose
* BaseInCamPose can be used in robotic grasping applications.
* If the tool coordinate system is placed at the gripper
* and a object detected at ObjInCamPose shall be grasped,
* the pose of the detected object relative
* to the robot base coordinate system has to be computed.
pose_invert (BaseInCamPose, CamInBasePose)
pose_compose (CamInBasePose, CalObjInCamPose, ObjInBasePose)

转载于:https://www.cnblogs.com/yangmengke2018/p/9743334.html

手眼标定eye-to-hand 示例:handeye_stationarycam_calibration相关推荐

  1. 【机器人手眼标定AX=XB(eye to hand和eye in hand)及平面九点法标定】

    一.背景 Calibration是机器人开发者永远的痛.虽然说方法说起来几十年前就有,但每一个要用摄像头的人都还是要经过一番痛苦的踩坑,没有轻轻松松拿来就效果好的包.其实人类不就是个手眼协调的先进&q ...

  2. 机器人抓取(五)—— 手眼标定 hand eye calibration

    1. 原理篇 参考:机器人手眼标定的基础理论分析 3D视觉之手眼标定 胡春旭:"手眼"结合完成物体抓取应用 在实际应用中,我们通常需要将相机观察到的外界环境中物体的姿态从相机坐标系 ...

  3. Ubuntu18.04 + kinova joca2机械臂 + RealSense D435i深度相机进行eye to hand手眼标定

    文章目录 前言 一.前期准备 1. RealSense D435i安装 2. Kinova-ROS安装 二.手眼标定环境配置 1. visip 2. aruco_ros 3. easy_handeye ...

  4. 手眼标定函数(eye -to-hand)

    相机跟随机械手移动 1.读相机初始内参 2.创建标定模型 3.设置相机初始参数 4.设置描述文件 5.设置优化方法 6.找标定板 7.获得标定板边缘轮廓 8.获得标定板mark点 9.读取机械手工具坐 ...

  5. 物体位姿估计精度验证实验(涉及位姿估计,手眼标定,机械臂运动)

    物体位姿估计精度验证实验(涉及位姿估计,手眼标定,机械臂运动) 1.位姿估计 2.手眼标定 Opencv 手眼标定函数calibrateHandEye() (1)Eye in Hand (1)Eye ...

  6. 把手眼标定结果(x,y,z,qx,qy,qz,qw)转换为变换矩阵 python代码实现

    import numpy as np from scipy.spatial.transform import Rotation as R import transformations as tf # ...

  7. 手眼标定算法Tsai-Lenz代码实现(Python、C++、Matlab)

    你好,我是小智. 上一节介绍了手眼标定算法Tsai的原理,这一节介绍算法的代码实现,分别有Python.C++.Matlab版本的算法实现方式. 该算法适用于将相机装在手抓上和将相机装在外部两种情况 ...

  8. opencv 图像上画出目标运动的轨迹_基于opencv的单目和双目标定平台手眼标定

      背景介绍 基于机器视觉引导的智能机器人,在现代社会各个领域已经得到了广泛的应用,尤其是大型工厂的自动化生产线上,视觉机器人可以和基于示教器按照预定轨迹进行作业的机器人互为补充,来共同提高生产的自动 ...

  9. 标定板标定和九点标定的区别_标定系列一 | 机器人手眼标定的基础理论分析

    旷视MegMaster机器人系列是旷视自主研发的一系列AI智能机器人硬件设备,基于旷视全球领先的人工智能算法及机器人技术,可实现搬运.分拣.托举.存储等功能,被广泛应用于物流仓储.工厂制造等场景.旷视 ...

最新文章

  1. 2018 百越杯 pwn(format WriteUp)
  2. 将PS/2接口鼠标改造成USB接口鼠标
  3. 远程链接oracle 12514,数据库建好后,本地连接正常,远程连接ORA-12514错误
  4. 28. extjs中Ext.BLANK_IMAGE_URL的作用
  5. 大合集!CVPR2021论文分方向整理: 目标检测/图像分割/医学影像等25个方向(持续更新)
  6. Lucene.net 下载地址
  7. Flex 4 [HostComponent] class xxx not found (AS code)
  8. 简单搜索 poj1321
  9. 的文件夹结构_小白指南:WordPress文件及目录结构解析
  10. TurboMail邮件服务器推动邮件领域的进一步发展
  11. Mr.Xu的找实习之路
  12. CUGBACM130715 组队赛 BNU Curvy Little Bottles - from lanshui_Yang
  13. PHP 类似time控件功能,最新火车头免费伪原创插件,多功能秒杀市面上所有同类工具...
  14. 总结一下__declspec(dllimport)的作用
  15. UEFI开发探索42 – Protocol的使用1
  16. 给body设置背景图片,整个图片完整的充满屏幕
  17. 【低碳发展案例研究】中国西部中小城市低碳发展研究——以泸州市为例
  18. 已经10月份了,焦虑不断怎么破……
  19. android 模拟器目录,Android 获取APP 文件目录 模拟器检测
  20. 拓嘉启远电商:为什么拼多多商品会掉资源位

热门文章

  1. 2021—2022学年面向中小学生的全国性竞赛活动名单
  2. P5703 【深基2.例5】苹果采购(scratch实现)
  3. Linux学习之C语言的进程与线程编程
  4. finereport字段显示设置_如何在Excel中显示和编辑中文拼音字段
  5. Linux基础学习十:Linux的权限管理
  6. cfb为什么不需要填充_学日语为什么不需要准备,现在就可以学?
  7. java8 stream 分组_Java 8 中 Map 骚操作之 merge() 的用法
  8. SQL工作笔记-达梦数据库关于时间的函数
  9. c语言判断回文平方数,C/C++回文数的判断(转)
  10. xp系统的WINS服务器设置,WindowsXP系统设置