原文作者写的一系列博客,挺不错的学习halcon:http://blog.sina.com.cn/s/blog_442bfe0e0100yjtn.html

1.get_image_pointer1(Image : : : PointerTypeWidthHeight)

返回第一通道的点,图像数据类型,图像尺寸。

2.disp_image(Image : : WindowHandle : )

在输出窗口显示灰度图像

3.visualize_results_of_find_marks_and_pose (ImageL, WindowHandle1, RCoordL, CCoordL, StartPoseL, StartCamParL)

内部函数,显示初步标定的坐标系和MARKS中心,MARKS中线用十字线标出。

4.set_calib_data_observ_points( : : CalibDataIDCameraIdxCalibObjIdx,CalibObjPoseIdxRowColumnIndexPose : )

储存以点为基础的标定观测值,将观测值储存与标定数据句柄中。

5.calibrate_cameras( : : CalibDataID : Error)

根据标定数据模型中的值标定摄像机。

6.get_calib_data( : : CalibDataIDItemTypeItemIdxDataName : DataValue)

查询储存或计算得到的标定模型中的数据。

7.write_cam_par( : : CameraParamCamParFile : )

把相机内参数写入TXT文件

8.write_pose( : : PosePoseFile : )

把相机的位姿写入TXT文件

9.gen_binocular_rectification_map( : Map1Map2 : CamParam1CamParam2RelPose,SubSamplingMethodMapType : CamParamRect1CamParamRect2CamPoseRect1,CamPoseRect2RelPoseRect)

把相机参数和姿态作为输入,输出为校正图像和矫正后的参数和姿态。

10.map_image(ImageMap : ImageMapped : : )

dev_update_window ('off')
* Set the image path
ImgPath := '3d_machine_vision/stereo/'
* Read the first images to get their size
i := 0
read_image (ImageL, ImgPath+'calib_distorted_l_'+i$'03d')
read_image (ImageR, ImgPath+'calib_distorted_r_'+i$'03d') //分别读取左右目图像,编号长3位//
* Reopen the windows with an appropriate size
dev_close_window ()
dev_close_window ()
get_image_pointer1 (ImageL, PointerL, TypeL, WidthL, HeightL)
get_image_pointer1 (ImageR, PointerR, TypeR, WidthR, HeightR)
dev_open_window (0, 0, WidthL, HeightL, 'black', WindowHandle1)
dev_open_window (0, WidthL+5, WidthL, HeightL, 'black', WindowHandle2)//为左右目各打开一

个图形窗口//
* Set the calibration plate description file
CaltabName := 'caltab_30mm.descr'
* Set the initial values for the interior camera parameters
StartCamParL := [0.0125, 0, 7.4e-6, 7.4e-6,WidthL/2.0,HeightL/2.0,WidthL,HeightL]
StartCamParR := StartCamParL
* parameter settings for find_caltab and find_marks_and_pose
SizeGauss := 3
MarkThresh := 120
MinDiamMarks := 5
StartThresh := 128
DeltaThresh := 10
MinThresh := 18
Alpha := 0.9
MinContLength := 15
MaxDiamMarks := 100
* Create a calibration data model in which all calibration data
* including the image coordinates of the calibration marks and
* the observation poses of the calibration plate will be
* accumulated
create_calib_data ('calibration_object', 2, 1, CalibDataID)      //创建标定数据模型句柄//
set_calib_data_cam_param (CalibDataID, 0, 'area_scan_division', StartCamParL)//在标定模型中

设置相机的类型和原始参数//
set_calib_data_cam_param (CalibDataID, 1, 'area_scan_division', StartCamParR)
set_calib_data_calib_object (CalibDataID, 0, CaltabName)        //定义一个标定对象//

* Start the loop over the calibration images
for i := 0 to 10 by 1
    * Read and display the calibration images
    read_image (ImageL, ImgPath+'calib_distorted_l_'+i$'03d')
    read_image (ImageR, ImgPath+'calib_distorted_r_'+i$'03d')
    disp_image (ImageL, WindowHandle1)
    disp_image (ImageR, WindowHandle2)                         //读取并显示图像//
    * Search for the calibration plate
  find_caltab (ImageL, CaltabL, CaltabName, SizeGauss, MarkThresh, MinDiamMarks)
  find_caltab (ImageR, CaltabR, CaltabName, SizeGauss, MarkThresh, MinDiamMarks)//输出标定板区域//
    disp_region (CaltabL, WindowHandle1)
    disp_region (CaltabR, WindowHandle2)                     //显示标定区域//          
    * Extract the calibration marks and estimate an initial pose
    find_marks_and_pose (ImageL, CaltabL, CaltabName, StartCamParL, StartThresh, DeltaThresh, MinThresh, Alpha, MinContLength, MaxDiamMarks, RCoordL, CCoordL, StartPoseL)
    * Visualize the extracted calibration marks and the
    * coordinate system defined by the estimated pose.
    visualize_results_of_find_marks_and_pose (ImageL, WindowHandle1, RCoordL, CCoordL, StartPoseL, StartCamParL)                      //显示初步标定的坐标系和MARKS中心//
    * Extraction of marks and pose as well as visualization of the
    * results for the second image.
    find_marks_and_pose (ImageR, CaltabR, CaltabName, StartCamParR, StartThresh, DeltaThresh, MinThresh, Alpha, MinContLength, MaxDiamMarks, RCoordR, CCoordR, StartPoseR)
    visualize_results_of_find_marks_and_pose (ImageR, WindowHandle2, RCoordR, CCoordR, StartPoseR, StartCamParR)
    * Store the image coordinates of the calibration marks as well
    * as the estimated initial poses for all stereo pairs in the
    * calibration data model
    *  - Camera 0 is the (L)eft camera
    *  - Camera 1 is the (R)ight camera
    set_calib_data_observ_points (CalibDataID, 0, 0, i, RCoordL, CCoordL, 'all', StartPoseL)
    set_calib_data_observ_points (CalibDataID, 1, 0, i, RCoordR, CCoordR, 'all', StartPoseR)
                                                        //在标定数据模型句柄中储存标定结果//

endfor
* Perform the actual calibration
calibrate_cameras (CalibDataID, Errors)         //根据标定数据模型中的值标定摄像机//
* Get the calibrated camera parameters
get_calib_data (CalibDataID, 'camera', 0, 'params', CamParamL)
get_calib_data (CalibDataID, 'camera', 1, 'params', CamParamR)      //获取摄像机参数//
* Since the left camera is the reference camera for the
* calib data model, the pose of the right camera is its
* pose relative to the left camera
get_calib_data (CalibDataID, 'camera', 1, 'pose', cLPcR)    //获取右目相对于左目的位姿//
* Store the results into files
write_cam_par (CamParamL, 'cam_left-125.dat')
write_cam_par (CamParamR, 'cam_right-125.dat')
write_pose (cLPcR, 'pos_right2left.dat')                    //将相机参数写入文件//
* Generate the rectification maps
gen_binocular_rectification_map (MapL, MapR, CamParamL, CamParamR, cLPcR, 1, 'geometric', 'bilinear', RectCamParL, RectCamParR, CamPoseRectL, CamPoseRectR, RectLPosRectR)
 //把相机参数和姿态作为输入,输出为校正图像和矫正后的参数和姿态。//
* Read in a stereo image pair, aquired with the stereo camera system,
* which has been calibrated, just now.
read_image (ImageL, ImgPath+'caliper_distorted_l')
read_image (ImageR, ImgPath+'caliper_distorted_r')
* Rectify the stereo images and display them
map_image (ImageL, MapL, ImageRectifiedL)
map_image (ImageR, MapR, ImageRectifiedR)
dev_set_window (WindowHandle1)
dev_clear_window ()
dev_display (ImageRectifiedL)
dev_set_window (WindowHandle2)
dev_clear_window ()
dev_display (ImageRectifiedR)
disp_continue_message (WindowHandle1, 'black', 'true')
stop ()
dev_set_window (WindowHandle2)
dev_close_window ()
dev_update_window ('on')
dev_set_window (WindowHandle1)
dev_clear_window ()
dev_display (ImageRectifiedL)
clear_calib_data (CalibDataID)

Halcon四 双目视觉的标定的更多相关文章

  1. halcon摄像机标定

    摄像机标定程序: 注意:E:/calibration_image :为标定图像文件路径       'E:/calibration_description/caltab_123mm.descr:为标定 ...

  2. Halcon相机标定

    摄像机标定程序: 注意:E:/calibration_image :为标定图像文件路径       'E:/calibration_description/caltab_123mm.descr:为标定 ...

  3. Halcon学习标定助手

    本文采用halcon标定助手进行标定. 第一步:打开标定助手. 第二步:对描述文件进行修改 具体:打开算子窗口,输入gen_caltab,进行描述文件修改. 参数XNum和YNum为7行*7列的圆,M ...

  4. 分享吉林大学机械科学与工程学院,zhao jun 博士的Halcon学习过程及知识分享

    分享吉林大学机械科学与工程学院,zhao jun 博士的Halcon学习过程及知识分享 全文转载zhao jun 博士的新浪博客,版权为zhaojun博士所有 原文地址:http://blog.sin ...

  5. 基于HALCON的双目立体视觉系统实现

    双目立体视觉是机器视觉的一种重要形式,它是基于视差原理并由多幅图像获取物体三维几何信息的方法.双目立体视觉系统一般由双摄像机从不同角度同时获得被测物的两幅数字图像,或由单摄像机在不同时刻从不同角度获得 ...

  6. 球体的双目视觉定位(matlab,附代码)

    球体的双目视觉定位(matlab,附代码) 标签(空格分隔): 机器视觉 引言 双目视觉定位是我们的一个课程设计,最近刚做完,拿出来与大家分享一下,实验的目的是在拍摄的照片中识别球体,并求出该球体到相 ...

  7. Halocn双目相机标定

    [Halcon]Halcon双目标定 相机标定(4)---基于halcon的双目立体视觉标定 双目立体视觉:四(双目标定matlab,图像校正,图像匹配,计算视差,disparity详解,) 双目测距 ...

  8. 相机标定简介与MatLab相机标定工具箱的使用(未涉及原理公式推导)

    相机标定 一.相机标定的目的 确定空间物体表面某点的三维几何位置与其在图像中对应点之间的相互关系,建立摄像机成像的几何模型,这些几何模型参数就是摄像机参数. 二.通用摄像机模型 世界坐标系.摄像机坐标 ...

  9. usb-cam (2)摄像机标定

    http://blog.csdn.net/heyijia0327/article/details/43538695 官方也给出了单目的标定教程和双目视觉的标定教程.本教程基于usb_cam  pack ...

随机推荐

  1. sql: having使用,及删除重复数据

    写了好几年的sql,having语句基本上很少写,这就有一点尴尬了,现在总结一下having的作用,每日整理一下学习文档. having 通常伴随group by使用,过滤group by的数据集. ...

  2. PHP字符串——简单应用

    错误的学习编码语言观点:语言语法不用记,多练习就可以了.   应该是死记住,然后加强练习以免忘记.以及在练习中加强理解.试着想“为什么是这样的语法习惯”.PHP提供了8种数据类型.4种是标量型(单值) ...

  3. 4-3 R语言函数 mapply

    #mapply(函数/函数名,数据,函数相关的函数) > list(rep(1,4),rep(2,3),rep(3,2),rep(4,1)) [[1]] [1] 1 1 1 1 [[2]] [1 ...

  4. 【bzoj 4710】 [Jsoi2011]分特产

    题目 容斥加组合计数 显然答案是 \[\sum_{i=0}^n(-1)^i\binom{n}{i}f_{n-i}\] \(f_i\)表示至多有\(i\)个人没有拿到特产 考虑求\(f\) 发现\(m\ ...

  5. Java并发编程--6.Exchanger线程间交换数据

    在两个线程之间定义同步点,当两个线程都到达同步点时,他们交换数据结构,因此第一个线程的数据结构进入到第二个线程中,第二个线程的数据结构进入到第一个线程中 在生产者-消费者情境模式中它包含了一个数缓冲区 ...

  6. Hive学习之路 (十二)Hive SQL练习之影评案例

    案例说明 现有如此三份数据:1.users.dat 数据格式为: 2::M::56::16::70072, 共有6040条数据对应字段为:UserID BigInt, Gender String, A ...

  7. Hadoop学习之路(十四)MapReduce的核心运行机制

    概述 一个完整的 MapReduce 程序在分布式运行时有两类实例进程: 1.MRAppMaster:负责整个程序的过程调度及状态协调 2.Yarnchild:负责 map 阶段的整个数据处理流程 3 ...

  8. virtualbox+vagrant学习-2(command cli)-26-vagrant share命令

    Share share命令初始化了一个vagrant share会话,允许你与世界上任何一个人共享vagrant环境,允许在几乎任何网络环境中直接在vagrant环境中进行协作. 你可以在本博客的vi ...

  9. 编写一个ComputerAverage抽象类,类中有一个抽象方法求平均分average,可以有参数。定义 Gymnastics 类和 School 类,它们都是 ComputerAverage 的子类。Gymnastics 类中计算选手的平均成绩的方法是去掉一个最低分,去掉一个最高分,然后求平均分;School 中计算平均分的方法是所有科目的分数之和除以总科目数。 要求:定义ComputerAv

    题目: 编写一个ComputerAverage抽象类,类中有一个抽象方法求平均分average,可以有参数. 定义 Gymnastics 类和 School 类,它们都是 ComputerAverag ...

  10. git乌龟http/https以及ssh clone的秘钥配置永久免密码登录设置

    1.安装 安装Git 安装TortoiseGit 乌龟客户端 首先下载安装一个git客户端这个就不多说了基本就是next一直到底 安装后首次新建一个项目project在git服务器上 2.配置 1.注 ...