Halcon形状模板匹配

总结:

(1)inspect_shape_model(Image : ModelImages, ModelRegions : NumLevels, Contrast : )        用于确定create_shape_model的Contrast和NumLevels参数,并显示图像效果,因此一般在create_shape_model之前使用。

(2)create_shape_model : 创建模板,其中参数MinContrast来过滤find_shape_models中找到的目标的中对比度小于阈值的目标,而使其忽略匹配

(3)get_shape_model_contours:用于观察create_shape_model模板的轮廓,生成位置在0点

(4)find_shape_model:查找模板,如果NumLevels参数设置为0则使用create_shape_model 中设置的NumLevels值。

(5)clear_shape_model (ModelID):关闭模板句柄

(6)dev_display_shape_matching_results:外部函数,展示所有查找到的目标的轮廓,但仅显示在底层金字塔的图像

(7)get_hom_mat2d_from_matching_result:外部函数,获取从模板轮廓初始生成位置移动到定位目标位置的变换矩阵

(8)write_shape_model:将模板写入文件

(9)其他:

read_shape_model;

create_scaled_shape_model;

create_shape_model_xld;

create_scaled_shape_model_xld;

set_shape_model_param;

get_shape_model_param;

find_shape_models;

find_scaled_shape_models;

案例一、align_measurements

* ------------------------------------------------------------------------------------------------
* This example program uses shape-based matching to align ROIs for the measure
* tool, which then inspects individual razor blades.
* The program can be run in two modes: (1) with the full affine transformation
*                                                                (2) using translate_measure
* Modify the next line to switch between the modes.
USING_TRANSLATE_MEASURE := 0
* ------------------------------------------------------------------------------------------------
* general configuration of HDevelopS
dev_update_window ('off')
* image acquisition and window size
read_image (ModelImage, 'razors1')
get_image_pointer1 (ModelImage, Pointer, Type, Width, Height)
dev_close_window ()
dev_open_window (0, 0, Width, Height, 'white', WindowHandle)
dev_set_part (0, 0, Height - 1, Width - 1)
dev_display (ModelImage)
* colors and other settings for the visualization
dev_set_color ('cyan')
dev_set_draw ('margin')
dev_set_line_width (2)
stop ()
* -------------------  start of the application  ----------------
* -> select the model object
Row1 := 46
Column1 := 57
Row2 := 79
Column2 := 94
gen_rectangle1 (ROIPart1, Row1, Column1, Row2, Column2)
gen_rectangle1 (ROIPart2, Row1 + 364, Column1 + 13, Row2 + 364, Column2 + 13)
union2 (ROIPart1, ROIPart2, ModelROI)
area_center (ModelROI, Area, CenterROIRow, CenterROI
  • 1
    点赞
  • 23
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

stephon_100

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值