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

       rotated or create_template_rot(与create_template不同,支持旋转) if the object has to be found also in a
       rotatedposition in the search image.
 
    • Search the model in images with best_match, best_match_mg, best_match_pre_mg,
       best_match_rot, best_match_rot_mg, fast_match, or fast_match_mg (see below for the
       differences between the operators).
       
        best_ 返回的最佳匹配点 是一个点
        fast_ 返回一个区域,是匹配到的区域
        ***_mg 是支持金字塔.
        **_rot_** 支持旋转 

• Clear the model from memory with clear_template.

一个例子,扣件匹配。

 
 
dev_close_window()

read_image(Image,,,Width,Height,.,.,.,.)

, rad(), rad(), rad(), to by  
    read_image(ImageDst,) 容许的最大匹配偏差
     则未匹配到 , 此时应该增加MaxEorr 
    ), rad(), ,\
                  , Row, Column, Angle, Error)
    count_seconds(endTime)
    Time ,,,)
    dev_display(Rectangle)
    stop()
endfor

clear_template(TemplateID)

 
 
3.2 Correlation-Based Matching 基于相关性的匹配
 
    This approach uses a normalized cross correlation (NCC 归一化互相关系数)to evaluate the correspondence between a model and a search image。它比传统的基于灰度的匹配更高效,对于变形,纹理缺失,图像模糊的对象也能找到。
 

 
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)
area_center(TemplateRegion,Area,RowRef,ColumnRef)
 
 
reduce_domain(Image,TemplateRegion,ImageTemplate)
 
create_ncc_model (ImageTemplate, 'auto',rad(-20), rad(20), 'auto', 'use_polarity', ModelID)
 
dev_set_draw('margin')
 
*匹配
for i :=103 to 200 by 1 
    read_image(ImageDst,'E:/钢轨缺陷/扣件下/'+i+' 1.bmp') 
    count_seconds(beginTime)
 
 
    *NumLevel 金字塔提高了速度 同时也会损失精准度
    find_ncc_model (ImageDst, ModelID, rad(-20), rad(20), 0.2, 1, 0, 'true',0 , Row, Column, Angle, Score)
    count_seconds(endTime)
    Time :=round(1000 * (endTime - beginTime))
 
  * gen_rectangle2(Rectangle,Row,Column,Angle,75,40)
    vector_angle_to_rigid(RowRef,ColumnRef,0,Row,Column,Angle,HomMat2D)
    affine_trans_region(TemplateRegion,ReginAffineTrans,HomMat2D,'false')
 
    dev_display(ImageDst)
  * dev_display(Rectangle)
    dev_display(ReginAffineTrans)
    disp_message(WindowHandle,Time+' ms','image',-1,-1,'black','true')
    stop()
endfor
 

clear_ncc_model(ModelID)

Matching (2)的更多相关文章

  1. 学习《Hardware-Efficient Bilateral Filtering for Stereo Matching》一文笔记。

    个人收藏了很多香港大学.香港科技大学以及香港中文大学里专门搞图像研究一些博士的个人网站,一般会不定期的浏览他们的作品,最近在看杨庆雄的网点时,发现他又写了一篇双边滤波的文章,并且配有源代码,于是下载下 ...

  2. LeetCode题解-----Wildcard Matching

    题目描述: '?' Matches any single character. '*' Matches any sequence of characters (including the empty ...

  3. cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'mvc:annotation-driven'.

    spring 配置文件报错报错信息:cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be ...

  4. [LeetCode] Wildcard Matching 外卡匹配

    Implement wildcard pattern matching with support for '?' and '*'. '?' Matches any single character. ...

  5. [LeetCode] Regular Expression Matching 正则表达式匹配

    Implement regular expression matching with support for '.' and '*'. '.' Matches any single character ...

  6. Beginning Scala study note(5) Pattern Matching

    The basic functional cornerstones of Scala: immutable data types, passing of functions as parameters ...

  7. ios 关于问题 no matching provisioning profiles found

    ios 关于问题 no matching provisioning profiles found

  8. iOS 苹果开发证书失效的解决方案(Failed to locate or generate matching signing assets)

    从2月14日开始,上传程序的同学可能会遇到提示上传失败的提示. 并且打开自己的钥匙串,发现所有的证书全部都显示此证书签发者无效. 出现以下情况: Failed to locate or generat ...

  9. ORA-12516:TNS:listener could not find available handler with matching protocol stack

    应用程序连接测试数据库时报ORA-12516:TNS:listener could not find available handler with matching protocol stack 检查 ...

  10. 基于MST的立体匹配及相关改进(A Non-Local Cost Aggregation Method for Stereo Matching)

    怀着很纠结的心情来总结这篇论文,这主要是因为作者提虽然供了源代码,但是我并没有仔细去深究他的code,只是把他的算法加进了自己的项目.希望以后有时间能把MST这一结构自己编程实现!! 论文题目是基于非 ...

随机推荐

  1. HDU - 4786 Fibonacci Tree (MST)

    题意:给一张由白边和黑边构成的无向图,求是否存在一个生成树,使白边的数量为一个斐波那契数. 分析:白边权值为1,黑边权值为0.求出该图的最小生成树和最大生成树,若这两个值之间存在斐波那契数,则可以,若 ...

  2. 论文笔记:Batch Normalization: Accelerating Deep Network Training by Reducing Internal Covariate Shift

    ICML, 2015 S. Ioffe and C. Szegedy 解决什么问题(What) 分布不一致导致训练慢:每一层的分布会受到前层的影响,当前层分布发生变化时,后层网络需要去适应这个分布,训 ...

  3. CSS 图片廊

    CSS 图片廊 一.示例一 代码: <!DOCTYPE html> <html> <head> <meta charset="utf-8" ...

  4. Send2MyKindle使用说明文档

    软件下载地址为:Send2MyKindle 功能简介 该软件主要功能为在Windows下将Kindle电子书发送到亚马逊中国网站注册的Kindle账户.整个软件界面如下图所示: 使用步骤 使用前的准备 ...

  5. Vue数据绑定失效

    首先,我们得明白Vue数据响应的原理: 以对象为例:当把一个JavaScript对象传给Vue实例的data选项时,Vue将遍历此对象所有的属性,并使用Object.defineProperty把这些 ...

  6. 20145303刘俊谦 《Java程序设计》第2周学习总结

    20145303刘俊谦 <Java程序设计>第2周学习总结 教材学习内容总结 1.对于标识符的一些名称规范(觉得挺重要而且容易混淆!定义就不写了,列一些例子): 包名: xxxyyyzzz ...

  7. CentOS7安装GNOME可视化界面

    1.首先安装X(X Window System),命令为 yum groupinstall "X Window System" 回车(注意有引号)   1CentOS Linux系 ...

  8. shell内置命令eval的具有什么作用

    答:把变量中的内容当成命令来执行

  9. openwrt下定义软件包的依赖关系类型

    在openwrt下软件包的依赖关系由DEPENDS:=来指定 第一种依赖关系类型为只有将依赖的软件包手动选上,当前的软件包就会自动被选中,用法为DEPENDS:=package_name 第二种依赖关 ...

  10. jsp选项卡导航实现——模板

    效果 刚进来页面的样子 在第二个选项卡上方时 点击后 离开 同样第三个 点击 移走鼠标 代码 <%@ page contentType="text/html;charset=UTF-8 ...