*关闭程序计数器,变量更新,图像窗口更新
dev_update_off ()
*关闭窗口
dev_close_window ()
*读取模版图像
read_image (Image, 'wafer/wafer_mirror_dies_01')
*创建与图像大小一样的图形窗口
dev_open_window_fit_image (Image, 0, 0, -1, -1, WindowHandle)
*设置字体属性
set_display_font (WindowHandle, 16, 'mono', 'true', 'false')
*定义输出区域,轮廓的线宽
dev_set_line_width (3)
*显示图像
dev_display (Image)
*在窗口指定位置显示文本的过程
disp_message (WindowHandle, 'Determine the position of mirror dies on the wafer', 'window', 12, 12, 'black', 'true')
*在窗口右下角显示文本
disp_continue_message (WindowHandle, 'black', 'true')
*停止
stop()
*
*创建一个矩形ROI
gen_rectangle1 (Rectangle, 362, 212, 414, 262)
*剪切ROI区域的图像
reduce_domain (Image, Rectangle, ImageReduced)
*根据金字塔数和对比度获取输入图像的金字塔图像,金字塔区域
inspect_shape_model (ImageReduced, ModelImages, ModelRegions, 4, 30)
*创建形状模版
create_shape_model (ImageReduced, 'auto', rad(0), rad(1), 'auto', 'auto', 'use_polarity', 'auto', 'auto', ModelID)
*获取模版的轮廓
get_shape_model_contours (ModelContours, ModelID, 1)
*
* 开始在搜索图像中搜索模版
for Index := 1 to 4 by 1
read_image (Image, 'wafer/wafer_mirror_dies_' + Index$'02')
* 计算当前过去的时间,单位是秒
count_seconds (S1)
*在搜索图像中搜索模版
find_shape_model (Image, ModelID, rad(0), rad(1), 0.5, 0, 0.0, 'least_squares', 2, 0.5, Row, Column, Angle, Score)
* 计算当前过去的时间,单位是秒
count_seconds (S2)
Runtime := (S2 - S1) * 1000
* 生成十字对象
gen_cross_contour_xld (Cross, Row, Column, 6, rad(45))
*显示找到的模版轮廓
dev_display_shape_matching_results (ModelID, 'lime green', Row, Column, Angle, 1, 1, 0)
*设置输出对象的颜色
dev_set_color ('orange')
*显示图像
dev_display (Image)
*显示十字
dev_display (Cross)
stop ()
endfor
get_system ('border_shape_models', mode)
* Clear the model
clear_shape_model (ModelID)
视觉定位之模版匹配
©著作权归作者所有,转载或内容合作请联系作者
- 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
- 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
- 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
推荐阅读更多精彩内容
- 本文要点总结(俩算法的联系与区别) Harris角点检测与Shi-Tomasi角点检测都是经典的角点特征提取算法,...
- 模板匹配的 概述 以及 使用简介 模板匹配是最简单的模式识别算法之一,其在图像处理中经常用于从一副未知图像中,根据...
- 自从2008年上大学以来,生日便一直在外面过。有时候感怀漂泊在外,甚至不愿意过生日,只想让这一天悄无声息地过去。尤...