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. apache服务器设置

    服务器目录 目录说明 bin: apache常用的一些命令 cgi-bin:存放一些脚本语言命令 conf:apache配置文件 error:错误记录 htodcs存放站点文件 logs:记录日志 m ...

  2. lightGallery 一个视屏不播放 解决方法

    这次使用了lightGallery,感觉还不错.样式比较美观,并且支持响应式. 使用过程中,我遇到了下面的问题: 当我 .picsgallery里面只有一个 .gItem的时候.点击弹出幻灯片,再点击 ...

  3. Datatable To List<Entity>

    public static DataTable ToDataTable<T>(this IEnumerable<T> varlist) { DataTable dtReturn ...

  4. handle 和module

    <httpHandlers> <add verb="*" path="*" type="ClassLibrary831.TestHa ...

  5. 【Head First Servlets and JSP】笔记 27: web 应用安全

    典型的安全问题:假冒者.窃听者.非法升级者 认证方式: Base64 .摘要认证 .客户端证书.表单认证,重点熟悉摘要算法( HASH . MD5 等) 安全机制:授权.认证.数据完整性.机密性 80 ...

  6. 20145321 《Java程序设计》第5周学习总结

    20145321 <Java程序设计>第5周学习总结 教材学习内容总结 第八章 1.Try.catch:Java中所有错误都会被打包为对象,通过try和catch语法可以对代表错误的对象做 ...

  7. 【vim】几种模式的切换

    很多初学者启动vim后,不知道怎么输入字符:按了半天字母,结果屏幕还是空的. vim和记事本或WORD不一样,不是一打开后就可以输入文字,此时它处于正常模式. vim一共有4个模式: 正常模式 (No ...

  8. 分布式缓存DistributedCache

    本文是对MR案例:Map-Join的解读. 在hadoop中,共享全局变量或全局文件的几种方法 使用Configuration的set()方法,只适合数据内容比较小的场景 将缓存文件放在HDFS上,每 ...

  9. JSON and XML Serialization in ASP.NET Web API

    https://docs.microsoft.com/en-us/aspnet/web-api/overview/formats-and-model-binding/json-and-xml-seri ...

  10. L1-3 宇宙无敌加法器 - 令人激动的一道题目

    L1-3 宇宙无敌加法器 - 令人激动的一道题目 感觉好久没有这么认真的做一道题了,今天看到一句话, 说是编程是一个工程型的工作,想要学好,"无他,唯手熟尔" 之前觉得自己笨,怀疑 ...