*
* 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)

手眼标定eye-to-hand 示例:handeye_stationarycam_calibration的更多相关文章

  1. 手眼标定之相机随动eye-in-hand 示例:handeye_movingcam_calibration

    * * This example explains how to use the hand eye calibration for the case where* the camera is atta ...

  2. halcon 手眼标定的坐标转换原理讲解

    原文链接:https://blog.csdn.net/opencv_learner/article/details/82113323 一直以来,对于手眼标定所涉及到的坐标系及坐标系之间的转换关系都没能 ...

  3. VINS-mono详细解读

    VINS-mono详细解读 极品巧克力 前言 Vins-mono是香港科技大学开源的一个VIO算法,https://github.com/HKUST-Aerial-Robotics/VINS-Mono ...

  4. 相机IMU融合四部曲(三):MSF详细解读与使用

    相机IMU融合四部曲(三):MSF详细解读与使用 极品巧克力 前言 通过前两篇文章,<D-LG-EKF详细解读>和<误差状态四元数详细解读>,已经把相机和IMU融合的理论全部都 ...

  5. Halcon10 下载

    Halcon10 下载地址:http://www.211xun.com/download_page_1.html HALCON 10 是一套机器视觉图像处理库,由一千多个算子以及底层的数据管理核心构成 ...

  6. Halcon11 Linux 下载

    Halcon11 Linux下载地址:http://www.211xun.com/download_page_3.html HALCON 11 是一套机器视觉图像处理库,由一千多个算子以及底层的数据管 ...

  7. Halcon17 Linux 下载

    Halcon17 Linux 下载地址:http://www.211xun.com/download_page_10.html HALCON 17 是一套机器视觉图像处理库,由一千多个算子以及底层的数 ...

  8. Halcon17 windows 下载

    Halcon17 windows 下载地址:http://www.211xun.com/download_page_9.html HALCON 17 是一套机器视觉图像处理库,由一千多个算子以及底层的 ...

  9. Halcon18 Linux For Armv7a 下载

    Halcon18 Linux For Armv7a 下载地址:http://www.211xun.com/download_page_16.html HALCON 18 是一套机器视觉图像处理库,由一 ...

随机推荐

  1. 浅析MSIL中间语言——基础篇(转)

    来自:https://www.cnblogs.com/dwlsxj/p/MSIL.html 一.开篇 研究MSIL纯属于个人喜好,说在前面MSIL应用于开发的地方很少,但是很大程度上能够帮着我们理解底 ...

  2. 第二节 Python基础之变量,运算符,if语句,while和for循环语句

    我们在上一节中,我们发现当我们用字符串进行一些功能处理的时候,我们都是把整个字符串写下来的,比如"jasonhy".startwith("j"),如果我们在程序 ...

  3. Ubuntu上的MySQL可以远程访问

    1. 3306端口是不是没有打开? 使用nestat命令查看3306端口状态: ~# netstat -an | grep 3306 tcp        0      0 127.0.0.1:330 ...

  4. javascript连连看

    经测试,IE,Firefox,Chrome,Opera可用. 连接线最多2个拐角.秘籍为:开始后连续输入zycjwdss 还剩0对   对数字 高度: 宽度: // 0)return 1;//IE i ...

  5. PAT 乙级 1044 火星数字 (20 分)

    1044 火星数字 (20 分) 火星人是以 13 进制计数的: 地球人的 0 被火星人称为 tret. 地球人数字 1 到 12 的火星文分别为:jan, feb, mar, apr, may, j ...

  6. 基于fastadmin快速搭建后台管理

    FastAdmin是一款基于ThinkPHP5+Bootstrap的极速后台开发框架:开发文档 下面对环境搭建简要概述,希望后来者能少走弯路: 1. 百度搜索最新版wampserver, 安装并启动 ...

  7. 基于STM8的TIM定时器操作---STM8-第三章

    1. 综述 STM8S提供三种类型的 TIM 定时器:高级控制型(TIM1).通用型(TIM2/TIM3/TIM5)和基本型定时器(TIM4/TIM6).它们虽有不同功能但都基于共同的架构.此共同的架 ...

  8. sqlserver 中NOLOCK、HOLDLOCK、UPDLOCK、TABLOCK、TABLOCKX

    https://www.cnblogs.com/sthinker/p/5922967.html

  9. webservice之jax-rs实现方式

    1.什么叫restful风格 restful是一组架构约束条件和原则,满足这些约束条件和原则的应用程序即是restful风格. 2.jax-rs实现步骤 1.创建一个简单应用(略) 2.添加依赖jar ...

  10. 一文搞清到底什么是 .NET?

    现在各种 .NET 满天飞,别说新手了,连我这样的老手都差点被绕进去.到底什么是 .NET 呢?通俗易懂,什么是.NET?什么是.NET Framework?什么是.NET Core? 这篇文章好长呀 ...