halcon使用直线标定板,标定相机内参代码
read_image (Image, '直线标定板图片/Left201118140641772.bmp')
get_image_size (Image, Width, Height)
dev_close_window ()
dev_open_window_fit_image (Image, 0, 0, -1, -1, WindowHandle)
dev_display (Image)
* Image Acquisition 01: Code generated by Image Acquisition 01
list_files ('直线标定板图片', ['files','follow_links'], ImageFiles)
tuple_regexp_select (ImageFiles, ['\\.(tif|tiff|gif|bmp|jpg|jpeg|jp2|png|pcx|pgm|ppm|pbm|xwd|ima|hobj)$','ignore_case'], ImageFiles)
gen_empty_obj (Edges)
*|ImageFiles|
for Index := 0 to |ImageFiles| - 1 by 1read_image (Image, ImageFiles[Index])edges_sub_pix (Image, ImageEdges, 'canny', 1, 10, 40)segment_contours_xld (ImageEdges, SplitEdges, 'lines_circles', 5, 4, 2)select_shape_xld (SplitEdges, SelectedEdges, 'contlength', 'and', 30, 100000)concat_obj (Edges, SelectedEdges, Edges)dev_display (Image)dev_set_colored (12)dev_display (SelectedEdges)
* wait_seconds (0.1)
endfor
stop ()radial_distortion_self_calibration (Edges, CalibrationEdges, Width, Height, 0.01, 42, 'division', 'variable', 0, CamParMultiImage)
dev_clear_window ()
dev_set_colored (12)
dev_display (CalibrationEdges)PosInImageX:=0
PosInImageY:=0
RadiusInImage:=0
*直线畸变矫正准备
change_radial_distortion_cam_par ('fixed', CamParMultiImage, 0, CamParMultiImageRect)
get_domain (Image, Domain)
create_metrology_model (MetrologyHandle)
* Image Acquisition 01: Code generated by Image Acquisition 01
list_files ('weizhi', ['files','follow_links'], ImageFiles)
tuple_regexp_select (ImageFiles, ['\\.(tif|tiff|gif|bmp|jpg|jpeg|jp2|png|pcx|pgm|ppm|pbm|xwd|ima|hobj)$','ignore_case'], ImageFiles)
for Index := 0 to |ImageFiles| - 1 by 1read_image (Image, ImageFiles[Index])* 直线标定change_radial_distortion_image (Image, Domain, ImageRectified, CamParMultiImage, CamParMultiImageRect)binary_threshold (ImageRectified, Region, 'max_separability', 'dark', UsedThreshold)fill_up (Region, RegionFillUp)difference (RegionFillUp, Region, RegionDifference)fill_up (RegionDifference, RegionFillUp1)connection (RegionFillUp1, ConnectedRegions)select_shape_std (ConnectedRegions, SelectedRegions, 'max_area', 70)smallest_circle (SelectedRegions, Row, Column, Radius)add_metrology_object_circle_measure (MetrologyHandle, Row, Column, Radius, Radius/10, Radius/60, 1, 90, ['measure_distance','min_score'], [Radius/30,0.2], Index1)apply_metrology_model (ImageRectified, MetrologyHandle)gen_empty_obj (Contours)get_metrology_object_measures (Contours, MetrologyHandle, 'all', 'all', Row1, Column1)get_metrology_object_result (MetrologyHandle, 'all', 'all', 'result_type', 'all_param', Parameter)get_metrology_object_result_contour (Contour, MetrologyHandle, 'all', 'all', 1.5)dev_display (ImageRectified)dev_display (Contour)PosInImageX[Index]:=Parameter[1]PosInImageY[Index]:=Parameter[0]RadiusInImage[Index]:=Parameter[2]
endfor
stop ()MacX:=[154.394,151.394,148.394,154.394,151.394,148.394,154.394,151.394,148.394]
MacY:=[-12.367,-12.367,-12.367,-14.368,-14.368,-14.368,-16.367,-16.367,-16.367]PointImageDis:=0
PointMacDis:=0distance_pp (PosInImageY[0], PosInImageX[0], PosInImageY[1], PosInImageX[1], Distance)
PointImageDis[0]:=Distancedistance_pp (MacY[0], MacX[0], MacY[1], MacX[1], Distance)
PointMacDis[0]:=Distancedistance_pp (PosInImageY[1], PosInImageX[1], PosInImageY[2], PosInImageX[2], Distance)
PointImageDis[1]:=Distancedistance_pp (MacY[1], MacX[1], MacY[2], MacX[2], Distance)
PointMacDis[1]:=Distancedistance_pp (PosInImageY[3], PosInImageX[3], PosInImageY[4], PosInImageX[4], Distance)
PointImageDis[2]:=Distancedistance_pp (MacY[3], MacX[3], MacY[4], MacX[4], Distance)
PointMacDis[2]:=Distancedistance_pp (PosInImageY[4], PosInImageX[4], PosInImageY[5], PosInImageX[5], Distance)
PointImageDis[3]:=Distancedistance_pp (MacY[4], MacX[4], MacY[5], MacX[5], Distance)
PointMacDis[3]:=Distancepix:=PointMacDis[0]/PointImageDis[0]vector_to_hom_mat2d (PosInImageX, PosInImageY, MacX, MacY, HomMat2D)//求解变换矩阵HomMat2D
affine_trans_point_2d (HomMat2D, PosInImageX, PosInImageY, Qx, Qy)//根据模板中心坐标求取距离相机中心实际距离
halcon使用直线标定板,标定相机内参代码相关推荐
- Halcon单相机标定—标定板标定和自标定 线扫相机标定
一.标定板标定 13.0 ************************************************************************************* * ...
- Halcon标定板标定流程
一.相机内参标定 目的:标定内参的目的是消除镜头的畸变. 面阵相机的内参由一个8位的数组组成包括: startCamPar:=[Focus,Kappa,Sx,Sy,Cx,Cy,ImageWidth,I ...
- OpenCv相机标定——圆形标定板标定
OpenCv相机标定--圆形标定板标定 0.前言 1.标定图案 2.OpenCv标定 3.标定结果分析 0.前言 OpenCv中,相机标定所使用的标定图案分为棋盘格.对称圆形及非对称圆形特征图.A ...
- Halcon标定板标定
halcon标定有自己的标定助手可以演示,不过拿到VS里面却不是很适用.尤其是关于畸变矫正和透视矫正算子的解释也没有,下面两个算子set_origin_pose,gen_image_to_world_ ...
- 计算机视觉——棋盘格标定法获取相机内参外参
计算机视觉--棋盘格标定法获取相机内参外参 一.原理 相机标定目的 相机标定的输入 相机标定的输出 相机标定策略 相机拍摄图像变换过程 相机内参 相机外参 二.环境 三.数据集 四.运行结果与分析 角 ...
- Halcon——使用标定板标定像素当量
使用标定板标定像素当量 1. 了解标定板的参数 2. 确定标定的方法 3. Halcon代码示例 1. 了解标定板的参数 拿到一块标定板,我们应该如何使用它,或者说该如何了解它的相关参数呢?如果你使用 ...
- VisionMaster标定板标定
选择工具 标定板生成工具我比较喜欢用海康自己研发的标2定板 具体参数看自己需求 最后选择0 导出图像就行 一般不需要cad图纸 保存 去路径下打印看看你的按照路径 我的是D:\VisionMa ...
- 使用直线标定板进行相机畸变校正,并且进行9点标定(halcon)
直线标定板图片: 机械吸头位置图片: 处理代码 read_image (Image, '直线标定板图片/Left201118140641772.bmp') get_image_size (Image, ...
- Halcon 圆形标定板标定基本流程-标定助手操作
Halcon 圆形标定板基本流程 1. 认识标定板: 2. 生成标定板的描述文件 3. 开始标定 4. 采集标定板的图像 5. 得到相机内外参 1. 认识标定板: 这个标定板的规格是 7×7: 标定板 ...
最新文章
- 炫舞时代服务器维护中怎么办,炫舞时代出bug是怎么回事 具体事件详细始末
- 数字图像处理:第二十二章 基于模型的编码
- C++中的deque、stack、queue及priority_queue
- PHP程序员如何突破技术瓶颈
- Java 操作POI 之复制sheet页
- java 子类tostring,JAVA中Object类的toString()方法,objecttostring
- tableau 自定义省份_在Tableau中使用自定义图像映射
- Linux日常运维管理技巧(四)文件同步工具-rsync、Linux系统日志、dmesg命令、lastb命令查看登录失败的用户、screen工具虚拟屏幕
- java8四大核心函数式接口(模拟实现,全网最通俗易懂)
- 数据分析与挖掘建模实战001:导学,概述
- 千字14图--Python慎用assert语句阻止代码执行
- [ExtJS6]Combobox的值的绑定
- jq 直接调用php文件_PHP性能分析工具,你在用哪一个?
- 安装McAfee 8.7i 提示错误1920怎么办?
- 【转载】聪明说话35招
- 主流量化交易的几种策略模型
- python过滤器_python中的Butterworth过滤器
- 2017计算机办公自动化试题,【2017年整理】计算机办公自动化试题.doc
- P1357 花园(dp快速幂转移)
- AMD64(x86_64)架构abi文档:上