halcon图像金字塔等级的理解和参数设置

金字塔等级的解释:https://blog.csdn.net/weixin_44490080/article/details/94471157

                        https://blog.csdn.net/dcrmg/article/details/52561656 

参数的设置:

在搜索过程中使用的金字塔层数是由NumLevels决定的。如果NumLevels设置为0,则使用创建模板时如create_scaled_shape_model中指定的金字塔层数。

可选地,NumLevels可以包含第二个值,该值确定所找到的匹配项被跟踪到的最低金字塔级别。因此,NumLevels的值[4,2]意味着匹配从第四个金字塔层开始,并跟踪匹配到第二个最低的金字塔层(最低的金字塔层用值1表示)。这种机制可以用来减少匹配的运行时间。然而,需要注意的是,在这种模式下,提取的位姿参数的精度通常低于正常模式,

在正常模式下,匹配被跟踪到金字塔的最低层次。NumLevels设置一个值的时候意味着匹配从设置的层数开始一直匹配到最底层。

算子:gen_gauss_pyramid(Image : ImagePyramid : Mode, Scale : )    生成高斯金字塔

算子gen_gauss_pyramid计算一个缩小图像的金字塔。下一幅图像的缩小比例由参数scale决定。例如,如果Scale的值为0.5,图像的边缘长度就会缩短50%。这完全等同于“正常”金字塔。

参数Mode决定了平均的方式。有关此参数的更详细描述,请参见affine_trans_image。在比例等于0.5的情况下,有额外的模式'min'和'max'可用。在这种情况下,选择四个相邻像素的最小值或最大值。

请注意,每一层将作为一个单独的图像返回,即作为一个标志性的对象,带有一个矩阵和它自己的域。可以使用select_obj或copy_obj分别选择单个或多个级别。

案例:find_shape_low_contrast_high_noise

形状模板匹配中改变金字塔等级参数NumLevels的效果

* This example demonstrates how to adapt parameters for images
* with a low contrast and high noise.
* Thereby, the most important influence is the lowest pyramid
* level (in the parameter NumLevels of find operators like
* find_scaled_shape_model).
* 
* Higher pyramid levels do not contain as much noise, so that
* the model can be found more easily there. The noise on lower
* pyramid levels sometimes prevents the found match from
* being tracked correctly.
* 
*//===================================================//*
ImgPath := 'crosses/'
read_image (Image, ImgPath + 'crosses_01')
dev_update_off ()
dev_close_window ()
dev_disp_workflow_text ()
stop ()
dev_close_window ()
dev_open_window_fit_image (Image, 0, 0, 640, 640, WindowHandle)
get_window_param (WindowHandle, 'flush', Flush)
set_window_param (WindowHandle, 'flush', 'false')
flush_buffer (WindowHandle)
set_display_font (WindowHandle, 14, 'mono', 'true', 'false')
dev_set_color ('lime green')
dev_set_line_width (3)
NumImages := 10
*//================================================================//*
*//================这一段展示自动金字塔参数的效果====================//*
* 
* Generate a model contour for use in create_shape_model_xld,
* create_scaled_shape_model_xld or create_aniso_shape_model_xld.
* The quality of the model contour is crucial.
*加载图像对象
read_object (ModelContour, 'model_contour')
*从XLD中创建模板,此时的金字塔等级仅用于创建模板时使用一次
create_scaled_shape_model_xld (ModelContour, 'auto', rad(-50), rad(100), 'auto', 0.75, 1.25, 'auto', 'auto', 'ignore_local_polarity', 5, ModelID)
get_shape
  • 2
    点赞
  • 21
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

stephon_100

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

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

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

打赏作者

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

抵扣说明:

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

余额充值