跟我学机器视觉-HALCON学习例程中文详解-IC引脚测量

合集下载
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

跟我学机器视觉-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 program

read_image (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)

****************显示图像如下:****************************************

dev_set_draw ('margin')

dev_set_line_width (3)

*

* Define and display the rectangular ROIs within which the edges will be detected

Row := 55

RowBottom := 955

Column := 200

Phi := rad(-90)

Length1 := 50

Length2 := 35

dev_set_color ('gray')

gen_rectangle2 (Rectangle, Row, Column, Phi, Length1, 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_neighbor'

****************************生成测量矩形框,先测上部**************************** 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 image

Sigma := 1.0

Threshold := 30

Transition := 'all'

Select := 'all'

**************************************进行测量******************************** measure_pos (Image, MeasureHandle, Sigma, Threshold, Transition, Select, RowEdge, ColumnEdge, Amplitude, Distance)

LeadLength1 := Distance

*

* Display the results

dev_set_color ('white')

***********************************将测量结果画出*****************************

disp_line (WindowHandle, RowEdge, ColumnEdge-Length2, RowEdge, ColumnEdge+Length2) disp_message (WindowHandle, 'Lead Length: '+LeadLength1$'.2f', 'window', RowEdge[1]+40, ColumnEdge[1]+100, 'yellow', 'false')

*

* Shift the measure object and determine the lead height at the bottom of the image

************************转移测量框至新的参考坐标点,及测量下部****************** translate_measure (MeasureHandle, RowBottom, Column)

**************************************进行测量******************************** measure_pos (Image, MeasureHandle, Sigma, Threshold, Transition, Select, RowEdge, ColumnEdge, Amplitude, Distance)

LeadLength2 := Distance

相关文档
最新文档