金字塔等级的解释: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