版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、跟我学机器视觉-halcon学习例程中文详解-ic引脚测量* lead measurement: example for the application of the measure object* including a lot of visualization operators.* first, the length of the leads is measured, then, their width and distance from each other.* * * first, read in the image and initialize the programread_im
2、age (image, 'ic_pin')*取得图像第一通道的指针,同时得到图像宽度高度*get_image_pointer1 (image, pointer, type, width, height)dev_close_window ()dev_open_window_fit_image (image, 0, 0, 509, 509, windowhandle)set_display_font (windowhandle, 14, 'mono', 'true', 'false')dev_display (image)*显示图像如
3、下:*dev_set_draw ('margin')dev_set_line_width (3)* * define and display the rectangular rois within which the edges will be detectedrow := 55rowbottom := 955column := 200phi := rad(-90)length1 := 50length2 := 35dev_set_color ('gray')gen_rectangle2 (rectangle, row, column, phi, length1
4、, length2)gen_rectangle2 (rectangle, rowbottom, column, phi, length1, length2)*测量位置如绿色矩形所示下:*disp_continue_message (windowhandle, 'black', 'true')stop ()* * create a measure object for the roi at the top of the image.*获取一阶灰度剖面图的插值方法,测量矩形框与图像坐标系之间有角度时生效*interpolation := 'nearest_n
5、eighbor'*生成测量矩形框,先测上部*gen_measure_rectangle2 (row, column, phi, length1, length2, width, height, interpolation, measurehandle)* * determine all edges and calculate the lead height at the top of the imagesigma := 1.0threshold := 30transition := 'all'select := 'all'*进行测量*measure_po
6、s (image, measurehandle, sigma, threshold, transition, select, rowedge, columnedge, amplitude, distance)leadlength1 := distance* * display the resultsdev_set_color ('white')*将测量结果画出*disp_line (windowhandle, rowedge, columnedge-length2, rowedge, columnedge+length2)disp_message (windowhandle,
7、'lead length: '+leadlength1$'.2f', 'window', rowedge1+40, columnedge1+100, 'yellow', 'false')* * shift the measure object and determine the lead height at the bottom of the image*转移测量框至新的参考坐标点,及测量下部*translate_measure (measurehandle, rowbottom, column)*进行测量*mea
8、sure_pos (image, measurehandle, sigma, threshold, transition, select, rowedge, columnedge, amplitude, distance)leadlength2 := distance* * display the resultsdev_set_color ('white')*将测量结果画出*disp_line (windowhandle, rowedge, columnedge-length2, rowedge, columnedge+length2)disp_message (windowh
9、andle, 'lead length: '+leadlength2$'.2f', 'window', 360, columnedge1+100, 'red', 'false')* * close the measureclose_measure (measurehandle)disp_continue_message (windowhandle, 'black', 'true')stop ()* * now, define and display a rectangular roi
10、 perpendicular to the leads and create the measuredev_display (image)row := 47column := 485phi := 0length1 := 420length2 := 8interpolation := 'nearest_neighbor'dev_set_color ('black')*创建新的测量矩形roi,如图蓝色矩形:*gen_rectangle2 (rectangle, row, column, phi, length1, length2)gen_measure_rectan
11、gle2 (row, column, phi, length1, length2, width, height, interpolation, measurehandle)* * determine all edge pairs that have a negative transition, i.e., edge pairs* that enclose dark regions.sigma := 1.0threshold := 30transition := 'negative'select := 'all'*进行测量计算并显示结果*measure_pairs
12、 (image, measurehandle, sigma, threshold, transition, select, rowedgefirst, columnedgefirst, amplitudefirst, rowedgesecond, columnedgesecond, amplitudesecond, intradistance, interdistance)disp_continue_message (windowhandle, 'black', 'true')stop ()dev_set_color ('white')disp_
13、line (windowhandle, rowedgefirst, columnedgefirst, rowedgesecond, columnedgesecond)avgleadwidth := sum(intradistance)/|intradistance|avgleaddistance := sum(interdistance)/|interdistance|numleads := |intradistance|disp_message (windowhandle, 'number of leads: '+numleads, 'window', 200
14、, 100, 'yellow', 'false')disp_message (windowhandle, 'average lead width: '+avgleadwidth$'.2f', 'window', 260, 100, 'yellow', 'false')disp_message (windowhandle, 'average lead distance: '+avgleaddistance$'.2f', 'window',
15、 320, 100, 'yellow', 'false')disp_continue_message (windowhandle, 'black', 'true')disp_continue_message (windowhandle, 'black', 'true')stop ()* * zoom in to visualize the measurement results in more detail.* first, define and display the zoom window.ro
16、w1 := 0column1 := 600row2 := 100column2 := 700dev_set_color ('blue')*设置放大区域矩形并显示,图中绿色矩形*disp_rectangle1 (windowhandle, row1, column1, row2, column2)disp_continue_message (windowhandle, 'black', 'true')stop ()* * then, zoom the image and display the results.*设置图像放大区域并显示*dev_set_part (row1, column1, row2, column2)dev_display (image)dev_set_color ('black')*画出测量矩形roi和测得的边缘如图*dev_display (rectangle)p_disp_edge_marker (rowedgefirst, columnedgefirst, phi, 5, 'white', 3, windowhandle)p
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2026上海银清企业服务有限公司招聘参考考试题库及答案解析
- 2026四川成都市双流区川大江安小学教师招聘11人参考笔试题库附答案解析
- 幼儿园校园风景摄影大赛方案摄影活动
- 2025甘肃兰州新区石化产业投资集团有限公司法务专干、造价工程师、会计岗位招聘6人备考笔试题库及答案解析
- 2026西藏民族大学急需紧缺人才引进2人备考考试试题及答案解析
- 深度解析(2026)《GBT 25936.4-2024橡胶塑料粉碎机械 第4部分团粒机安全要求》(2026年)深度解析
- 深度解析(2026)《GBT 25907.3-2010信息技术 维吾尔文、哈萨克文、柯尔克孜文编码字符集 16点阵字型 第3部分:库非白体》
- 2026年威海乳山市民兵训练基地公开招聘事业单位工作人员(1名)参考考试题库及答案解析
- 痛风抗炎症治疗指南(2025 版)解读
- 2025江苏盐城市交通运输局直属事业单位选调1人参考考试试题及答案解析
- UL347a标准中文版-2019中压电力转换设备UL标准中文版
- 北京市西城区2023-2024学年六年级上学期语文期末试卷(含答案)
- DB11T 850-2011 建筑墙体用腻子应用技术规程
- 城市轨道交通列车自动控制系统维护 课件 3.1 ZC系统认知
- 2024年天津市南开区翔宇学校四上数学期末检测模拟试题含解析
- LNG加气站管道工程施工方案
- 油漆作业风险和隐患辨识、评估分级与控制措施一览表
- NB/T 11440-2023生产煤矿储量估算规范
- 洁净工厂设计合同范本
- 无人机应用技术专业申报表
- PDCA提高卧床患者踝泵运动的执行率
评论
0/150
提交评论