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. Java 为什么要使用反射(通俗易懂的举例)

    Java反射最大的好处就是能在运行期间,获得某个类的结构.成员变量,用来实例化. 下列是具体使用场景:假如我们有两个程序员,一个程序员在写程序的时候,需要使用第二个程序员所写的类,但第二个程序员并没完 ...

  2. C/C++结构体总结

    1  #include"iostream"  2  using  namespace  std;  3    4  struct  TestStruct  5  {  6      ...

  3. svn不提交.net项目中的bin

    1 选中 bin->右击->tortoiseSVN->add to ignore list->选择第二个 2 提交 , 服务器上就没有bin目录了.

  4. [Android] 录音与播放录音实现

    http://blog.csdn.net/cxf7394373/article/details/8313980 android开发文档中有一个关于录音的类MediaRecord,一张图介绍了基本的流程 ...

  5. centos安装xdebug 和 phpstorm+Xdebug断点调试PHP

    转载地址:http://www.2cto.com/os/201304/206058.html   CentOS下安装xdebug   在CentOS 6.x 的系统中,是集成xdebug 的,   y ...

  6. MWeb Lite以及Eclipse的使用感想

    MWeb Lite以及Eclipse的使用感想 1.首先说明的是MWeb Lite是一种Markdown软件,Eclipse是用于做java开发的,都用于Mac系统中.因为Mac系统本身较为人性化的设 ...

  7. 20145324 《Java程序设计》第5周学习总结

    20145324 <Java程序设计>第5周学习总结 教材学习内容总结 第八章 1.java中所有错误都会被包装成为对象 2.可以使用尝试(try)执行程序并捕捉代表错误的对象后做一些处理 ...

  8. 百度console输出

    try{ if(window.console&&window.console.log) { console.log("一张网页,要经历怎样的过程,才能抵达用户面前?\n一位新 ...

  9. MR案例:分区和排序

    现有一学生成绩数据,格式如下:<学号,姓名,学院,成绩>  //<id, name, institute, grade>. 需求描述:查询成绩大于等于60分的学生数据,按学院分 ...

  10. # fabirc 配置多组服务器 密码与密钥一起使用 key_filename的设置

    环境说明 myv myv2 是配置在/etc/hosts 的两台 虚拟机 虚拟机ip. 参考英文文档 官方文档的例子不是给的很详细.. http://docs.fabfile.org/en/1.13/ ...