码迷,mamicode.com
首页 > 其他好文 > 详细

Match-----Correlation-----find_ncc_model_exposure

时间:2018-08-29 01:10:11      阅读:316      评论:0      收藏:0      [点我收藏+]

标签:training   次数   match   extent   div   mat   tdd   close   win   

* This example program shows how to use HALCON‘s correlation-based
* matching. In particular it demonstrates the robustness of this method against
* linear illumination changes. The training is performed in an image with good
* illumination. The matching is applied in images where the exposure time varies
* extremely from very short to very long.

********光照不均匀、明暗变化、且背景最好不能太复杂时用相关性匹配********
read_image (Image, ‘cap_exposure/cap_exposure_03‘)
get_image_size (Image, Width, Height)
dev_close_window ()
dev_open_window (0, 0, Width, Height, ‘black‘, WindowHandle)
dev_update_window (‘off‘)
dev_display (Image)
gen_circle (Circle, 246, 336, 150)
area_center (Circle, Area, RowRef, ColumnRef)
reduce_domain (Image, Circle, ImageReduced)
*create_ncc_model(Template : : NumLevels, AngleStart, AngleExtent, AngleStep, Metric : ModelID)
*Template指定模板的单通道图像:单通道灰度图像
*NumLevels指定最高金字塔等级:金字塔最大层数,层数越多(向下),搜索的越快,但精度下降
*AngleStart指定模板最小旋转角度:模板最小的旋转角度
*AngleExtent指定模板角度的扩展范围:模板旋转范围
*AngleStep指定步距:每次旋转角度的步长(步长越小,旋转次数越多,越耗时?)
*Metric指定匹配标准:极性 ignore_global_polarity:忽略全局极性(对比度不好的忽略)
*ModelID:句柄 即标示
create_ncc_model (ImageReduced, ‘auto‘, 0, 0, ‘auto‘, ‘use_polarity‘, ModelID)
dev_set_draw (‘margin‘)
dev_display (Image)
dev_display (Circle)
stop ()
Rows := []
Cols := []
for J := 1 to 10 by 1
*J$‘02‘ 表示此字符宽度为2,左边补0 J=1时为‘01’ J=2时为‘02’ 以此类推
read_image (Image, ‘cap_exposure/cap_exposure_‘ + J$‘02‘)
*find_ncc_model(Image : : ModelID, AngleStart, AngleExtent, MinScore, NumMatches, MaxOverlap, SubPixel, NumLevels : Row, Column, Angle, Score)
*在输入图像中查找指定数目的NCC模板实例
*Image : : ModelID, AngleStart, AngleExtent:同上
*MinScore指定模型查找得分阈值:0~1之间 越高越不容易被找到
*NumMatches:指定要查找的匹配实例的数目 0:缺省(都找)
*MaxOverlap:指定最大交叠系数 0~1之间 接近1两个模板冲动容易被找到 接近0模板重叠越不容易被找到
*SubPixel:指定是否要求亚像素精度匹配
*NumLevels:指定匹配的金字塔等级
*Row, Column, Angle, Score:输出查找到的模板实例的行坐标、列坐标、角度、得分(可能是一组或者多组) Angle指与水平的夹角
find_ncc_model (Image, ModelID, 0, 0, 0.5, 1, 0.5, ‘true‘, 0, Row, Column, Angle, Score)
* disp_circle (WindowHandle, Row, Column, 150)
vector_angle_to_rigid (RowRef, ColumnRef, 0, Row, Column, 0, HomMat2D)
*临近插值
affine_trans_region (Circle, RegionAffineTrans, HomMat2D, ‘nearest_neighbor‘)
***********注意语法***********
Rows := [Rows,Row]
Cols := [Cols,Column]
dev_display (Image)
dev_display (RegionAffineTrans)
stop ()
endfor
* Compute the standard deviation of the found positions. If the individual
* positions in Rows and Cols are examined, it can be seen that the standard
* deviation is caused mainly by the last four images, which are severely
* overexposed.
*求标准偏差
StdDevRows := deviation(Rows)
StdDevCols := deviation(Cols)
clear_ncc_model (ModelID)

Match-----Correlation-----find_ncc_model_exposure

标签:training   次数   match   extent   div   mat   tdd   close   win   

原文地址:https://www.cnblogs.com/yangmengke2018/p/9551575.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!