匹配算法
来源:互联网 发布:买鞋进销存软件 编辑:程序博客网 时间:2024/05/12 12:39
HALCON 10.0 II-B
3.1 Gray-Value-Based Matching
基于灰度的匹配是一个非常经典的方法,它仅适用于对象的不模糊,不缺失,灰度值不变化。适用于对象旋转转。注意对
于所有的应用,相关性和基于形状的匹配是要优先考虑的。使用灰度匹配的理由可能是由于匹配的对象和灰度有关系。
The rare cases in which the very slow classical gray-valuebased matching is to be preferred comprise the case that the matching must be illumination-variant. If, e.g. a colored pattern has to be found and the hue value of the object in the search image must not deviate from the hue value of the object in the template image, the illumination-invariant approaches might be less suitable, as they use normalized gray values, i.e., they evaluate the relative differences between the grayvalues instead of the absolute values.
使用灰度值匹配的步骤:
• Create a model with create_template if the object is expected to be only translated but not
• Clear the model from memory with clear_template.
一个例子,扣件匹配。
dev_close_window()
read_image(Image,'E:/钢轨缺陷/扣件下/227 1.bmp')
get_image_size(Image,Width,Height)
dev_open_window(0,0,Width,Height,'black',WindowHandle)
dev_display(Image)
*draw_rectangle1(WindowHandle,Row1,Column1,Row2,Column2)
*gen_rectangle1(TemplateRegion,Row1,Column1,Row2,Column2)
gen_rectangle1(TemplateRegion,5.0,38.5,84.0,186.5)
*equ_histo_image(Image,Image)
reduce_domain(Image,TemplateRegion,ImageTemplate)
*创建模板
**************************************************
* create_template_rot(Template 用于做模板的图像
* : : NumLevel, 金字塔数
* AngleStart, 最小旋转角度
* AngleExtend,最大旋转角度
* AngleStep,旋转步长
* Optimize, 优化选项 sort /none (sort 创建模板的时间会长点,随之
* 带来的是匹配更准确
* GrayValues : 原始灰度值: original
* normalized
* 梯度:gradient sobel
* TemplateID)
******************************************************
create_template_rot (ImageTemplate, 4, rad(0), rad(360), rad(1), 'sort', 'sobel', TemplateID)
dev_set_draw('margin')
*匹配
for i :=67 to 200 by 1
read_image(ImageDst,'E:/钢轨缺陷/扣件下/'+i+' 1.bmp')
dev_display(ImageDst)
count_seconds(beginTime)
*
*MaxEorr (0~255) 容许的最大匹配偏差
*Error 返回实际匹配到的偏差 。如果是255 则未匹配到 , 此时应该增加MaxEorr
*
best_match_rot_mg (ImageDst, TemplateID, rad(0), rad(360), 100,\
'false', 4, Row, Column, Angle, Error)
count_seconds(endTime)
Time :=round(1000 * (endTime - beginTime))
disp_message(WindowHandle,Time+' ms','image',-1,-1,'black','true')
gen_rectangle2(Rectangle,Row,Column,Angle,75,40)
dev_display(Rectangle)
stop()
endfor
clear_template(TemplateID)
- 匹配算法
- 匹配算法
- 匹配算法
- 算法 字符串匹配算法
- 字符串匹配算法
- 模式匹配---KMP算法
- 文件名通配符匹配算法
- BM字符串匹配算法
- 串匹配TJ算法
- 模式匹配 KMP算法
- 模式匹配-KMP算法
- KMP 字符串匹配算法
- 最大正向匹配算法
- 模式匹配小算法
- 模式匹配小算法
- 字符串匹配算法
- 字符串匹配算法
- 字符串匹配算法(摘)
- 存储系统--概述
- Effective C++ 06:若不想使用编译器自动生成的函数,就该明确拒绝
- 使用DownloadManager实现下载更新
- html data-*自定义属性的
- Linux top VIRT RES SHR SWAP DATA内存参数详解
- 匹配算法
- jquery Ajax 返回JSON报错: org.apache.struts2.json.JSONException: java.lang.reflect.InvocationTargetExce
- Android RecyclerView——总结自DavidSmith的视频
- Git学习笔记(远程仓库)
- 反转字符串
- 关于计算机领域的各种学习交流网站
- <Torch>~1.初接触(溪欲焰)
- 【Apache-Shiro】shiro配置详解
- 搜索框输入特殊字符后台的简单处理方式