跟我学机器视觉HALCON学习例程中文详解IC引脚测量_第1页
跟我学机器视觉HALCON学习例程中文详解IC引脚测量_第2页
跟我学机器视觉HALCON学习例程中文详解IC引脚测量_第3页
跟我学机器视觉HALCON学习例程中文详解IC引脚测量_第4页
跟我学机器视觉HALCON学习例程中文详解IC引脚测量_第5页
已阅读5页,还剩4页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

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. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

最新文档

评论

0/150

提交评论