工业领域-半导体业-apply_metrology_model

* This example shows the usage of the metrology model to measure circles and rectangles with subpixel accuracy under challenging conditions easily.   这个例程展示了使用度量模型在在极具挑战的情况下使用亚像素精度下对圆形和矩形的精度测量


* Display initializations
dev_update_off ()    //关闭自动更新
read_image (Image, 'pads')    //读取图片
get_image_size (Image, Width, Height)    //获取图片宽高
dev_close_window ()    //关闭窗体
dev_open_window_fit_image (Image, 0, 0, -1, -1, WindowHandle)    //以合适图片的大小打开一个窗体
set_display_font (WindowHandle, 14, 'mono', 'true', 'false')    //设置字体

* Define the approximate position and the measure tolerance for the circles  定义圆的近似位置和测量公差
RowCircle := [52:89:500]    //定义一个第一个元素为52,最后一个元素不超过500,间距为89的等差数组[52,141,230,319,408,487]
CircleInitRow := [RowCircle,RowCircle]    //行坐标[52,141,230,319,408,487,52,141,230,319,408,487]
CircleInitColumn := [gen_tuple_const(6,348),gen_tuple_const(6,438)]    //列坐标[348,348,348,348,348,348,438,438,438,438,438,438]
gen_cross_contour_xld (Cross1, CircleInitRow, CircleInitColumn, 6, 0.785398)   //生成十字6为长度,0.785为弧度的45度即3.14/4
CircleInitRadius := [gen_tuple_const(6,23),gen_tuple_const(6,23)]
CircleRadiusTolerance := 12
* Define the approximate position and the measure tolerance for the rectangles 定义矩形的近似位置和测量公差
RectangleInitRow := [410,410]
RectangleInitColumn := [215,562]
RectangleInitPhi := [0,0]
RectangleInitLength1 := [85,85]
RectangleInitLength2 := [88,88]
RectangleTolerance := 10

* Prepare the metrology model data structure  //创建测量模型
create_metrology_model (MetrologyHandle)
* Setting the image width in advance is not necessary, but improves the runtime of the first measurement.  //可以不用设置模型图片尺寸,但是会影响第一次的运行时间
set_metrology_model_image_size (MetrologyHandle, Width, Height)
* Add the metrology rectangle objects to the model as defined above  //将计量矩形对象添加到上面定义的模型中
add_metrology_object_rectangle2_measure (MetrologyHandle, RectangleInitRow, RectangleInitColumn, RectangleInitPhi, RectangleInitLength1, RectangleInitLength2, RectangleTolerance, 5, .5, 1, [], [], MetrologyRectangleIndices)
* Add the metrology circle objects to the model as defined above  //将计量圆形对象添加到上面定义的模型中
add_metrology_object_circle_measure (MetrologyHandle, CircleInitRow, CircleInitColumn, CircleInitRadius, CircleRadiusTolerance, 5, 1.5, 2, [], [], MetrologyCircleIndices)
* It is possible to measure more than one circle/rectangle/line/ellipse instance per metrology object in one call.
* Since we like to measure two circles per object, we set 'num_instances' to 2.

set_metrology_object_param (MetrologyHandle, MetrologyCircleIndices, 'num_instances', 2)
* Setting 'measure_transition' to 'uniform' assures that only consistent circles are returned, that have either only edges from bright to dark or vice versa. //将'measure_transition'设置为'uniform'可以确保只返回一致的圆,它们只有从亮到暗的边,反之亦然。
* Since the consistency check increases runtime, it is switched of by default. In this example however, it is safer to switch it on, because both negative and positive edges are present.//由于一致性检查会增加运行时间,因此默认情况下会进行切换。 然而,在该示例中,将其打开更安全,因为存在负边缘和正边缘。

set_metrology_object_param (MetrologyHandle, MetrologyCircleIndices, 'measure_transition', 'uniform')
* Setting the minimum score can make the results more robust  //设置分数能使结果更加稳健
set_metrology_object_param (MetrologyHandle, MetrologyCircleIndices, 'min_score', .9)

* Perform the measurement  //执行测量

apply_metrology_model (Image, MetrologyHandle)

get_metrology_object_result (MetrologyHandle, MetrologyRectangleIndices, 'all', 'result_type', 'all_param', RectangleParameter)
* Extract the parameters for better readability  //提取参数以获得更好的可读性
Sequence := [0:5:|RectangleParameter| - 1]
RectangleRow := RectangleParameter[Sequence]
RectangleColumn := RectangleParameter[Sequence + 1]
RectanglePhi := RectangleParameter[Sequence + 2]
RectangleLength1 := RectangleParameter[Sequence + 3]
RectangleLength2 := RectangleParameter[Sequence + 4]

* Access the results of the circle measurement  //访问圆结果

get_metrology_object_result (MetrologyHandle, MetrologyCircleIndices, 'all', 'result_type', 'all_param', CircleParameter)
* Extract the parameters for better readability  //提取参数以获得更好的可读性
Sequence := [0:3:|CircleParameter| - 1]
CircleRow := CircleParameter[Sequence]
CircleColumn := CircleParameter[Sequence + 1]
CircleRadius := CircleParameter[Sequence + 2]

* Display the results

* Get measured contours   //获得测量轮廓

get_metrology_object_result_contour (Contours, MetrologyHandle, 'all', 'all', 1.5)
* Get the contours of the measure regions and the coordinates of the edge points that were the basis for fitting the circles and rectangles  //获取测量区域的轮廓和边缘点的坐标,这些是匹配圆和矩形的基础
get_metrology_object_measures (Contour, MetrologyHandle, 'all', 'all', Row1, Column1)
gen_cross_contour_xld (Cross, Row1, Column1, 6, 0.785398)
* Display everything
Color := ['gray','cyan','green']
dev_display (Image)
dev_set_line_width (1)
dev_set_color (Color[0])
dev_display (Contour)
dev_set_color (Color[1])
dev_display (Cross)
dev_set_line_width (2)
dev_set_color (Color[2])
dev_display (Contours)
Message := Color[2] + ': Measurement result'
Message[1] := Color[1] + ': Edge candidate points'
Message[2] := Color[0] + ': Measure regions'
disp_message (WindowHandle, Message, 'window', 12, 12, 'black', 'true')

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值