[Halcon]determine_shape_model_params
- 学习并认识Halcon算子
- 英文原文
- Name
- Signature
- Description
- determine_shape_model_params determines certain parameters of a shape model automatically from the model image Template. The parameters to be determined can be specified with Parameters. determine_shape_model_params can be used to determine the same parameters that are determined automatically when the respective parameter in create_shape_model, create_scaled_shape_model, or create_aniso_shape_model is set to 'auto': the number of pyramid levels (Parameters = 'num_levels'), the angle step length (Parameters = 'angle_step'), the scale step length (Parameters = 'scale_step' for isotropic scaling and 'scale_r_step' and/or 'scale_c_step' for anisotropic scaling), the kind of optimization (Parameters = 'optimization'), the threshold (Parameters = 'contrast') or the hysteresis thresholds (Parameters = 'contrast_hyst') for the contrast, the minimum size of the object parts (Parameters = 'min_size'), and the minimum contrast (Parameters = 'min_contrast'). By passing a tuple of the above values in Parameters, an arbitrary combination of these parameters can be determined. If all of the above parameters should be determined, the value 'all' can be passed. In this case both hysteresis thresholds are determined, i.e., the operator behaves like passing 'contrast_hyst' instead of 'contrast'.
- determine_shape_model_params is mainly useful to determine the above parameters before creating the model, e.g., in an interactive system, which makes suggestions for these parameters to the user, but enables the user to modify the suggested values.
- The automatically determined parameters are returned as a name-value pair in ParameterName and ParameterValue. The parameter names in ParameterName are identical to the names in Parameters, where, of course, the value 'all' is replaced by the actual parameter names. An exception is the parameter 'contrast_hyst', for which the two values 'contrast_low' and 'contrast_high' are returned.
- The remaining parameters (NumLevels, AngleStart, AngleExtent, ScaleMin, ScaleMax, Optimization, Metric, Contrast, and MinContrast) have the same meaning as in create_shape_model, create_scaled_shape_model, and create_aniso_shape_model. The description of these parameters can be looked up with these operators. These parameters are used by determine_shape_model_params to calculate the parameters to be determined in the same manner as in create_shape_model, create_scaled_shape_model, and create_aniso_shape_model. It should be noted that if the parameters of a shape model with isotropic scaling should be determined, i.e., if Parameters contains 'scale_step' either explicitly or implicitly via 'all', the parameters ScaleMin and ScaleMax must contain one value each. If the parameters of a shape model with anisotropic scaling should be determined, i.e., if Parameters contains 'scale_r_step' or 'scale_c_step' either explicitly or implicitly, the parameters ScaleMin and ScaleMax must contain two values each. In this case, the first value of the respective parameter refers to the scaling in the row direction, while the second value refers to the scaling in the column direction.
- Note that in determine_shape_model_params some parameters appear that can also be determined automatically (NumLevels, Optimization, Contrast, MinContrast). If these parameters should not be determined automatically, i.e., their name is not passed in Parameters, the corresponding parameters must contain valid values and must not be set to 'auto'. In contrast, if these parameters are to be determined automatically, their values are treated in the following way: If the optimization or the (hysteresis) contrast is to be determined automatically, i.e., Parameters contains the value 'optimization' or 'contrast' ('contrast_hyst'), the values passed in Optimization and Contrast are ignored. In contrast, if the maximum number of pyramid levels or the minimum contrast is to be determined automatically, i.e., Parameters contains the value 'num_levels' or 'min_contrast', you can let HALCON determine suitable values and at the same time specify an upper or lower boundary, respectively:
- If the maximum number of pyramid levels should be specified in advance, NumLevels can be set to the particular value. If in this case Parameters contains the value 'num_levels', the computed number of pyramid levels is at most NumLevels. If NumLevels is set to 'auto' (or 0 for backwards compatibility), the number of pyramid levels is determined without restrictions as large as possible.
- If the minimum contrast should be specified in advance, MinContrast can be set to the particular value. If in this case Parameters contains the value 'min_contrast', the computed minimum contrast is at least MinContrast. If MinContrast is set to 'auto', the minimum contrast is determined without restrictions.
- 机翻中文
- 描述
- determine_shape_model_params算子通过模板图片Template自动确定形状模板的某些参数。通过输入参数Parameters确定哪些参数需要自动确定。create_shape_model, create_scaled_shape_model, create_aniso_shape_model 算子中有参数设置为"auto"想要让系统自动确定参数,determine_shape_model_params就可以用来确定这些自动确定的具体数值:
- 可以求金字塔等级(Parameters = 'num_levels'),
- 可以求角度的步长(Parameters = 'angle_step'),
- 可以求缩放的步长(Parameters = 'scale_step' 求各向同性的步长 'scale_r_step' and/or 'scale_c_step' 求各向异性的补偿),
- 可以确定找点优化的类型(Parameters = 'optimization'),
- 求阈值范围(Parameters = 'contrast') 或对比度即磁滞阈值范围 (Parameters = 'contrast_hyst'), 确定搜索目标的最小尺寸(Parameters = 'min_size'),
- 确定最小对比度的值 (Parameters = 'min_contrast')
- 算子的输入参数Parameters,可以包含以上出现过的值随机组合而成的数组。如果以上的值都是需要的,可以将输入参数Parameters设置成"all", 在这种情况下,用到阈值的地方都会将阈值替换为磁滞阈值。
- 算子determine_shape_model_params主要用于例如在一个交互系统里创建模板前确定以上提到的值的数值或范围, 给用户参数建议, 方便用户修改参数为适当的值。
- 这些原本是自动确定的参数根据"名字-数值"格式返回一个确定的数值在输出参数ParameterName 和ParameterValue。 输出参数ParameterName 并不是和输入参数Parammeters按顺序一一对应, 当然输出的名字和数值是一一对应的, 而输入"all",输出的是所有的参数和对应的值。而输入参数磁滞阈值, 会返回两个数值:高阈值和低阈值。
- 剩余的其他参数(NumLevels, AngleStart, AngleExtent, ScaleMin, ScaleMax, Optimization, Metric, Contrast, and MinContrast) 在算子 create_shape_model, create_scaled_shape_model, create_aniso_shape_model里有同样的含义。所以这些参数的含义可以去查看这三个创建模板算子的说明。在算子 determine_shape_model_params里确定这些参数的方法和这三个创建模板算子是一样的。值得注意的是形状模板中缩放无论是各向同性还是各向异性, 缩放大小应该明确指明,例如:输入参数Parameter包含各向同性的"scale_step", ScaleMin和ScaleMax各包含一个确定的数值;而输入参数Parameter包含各向异性的"scale_r_step"或"scale_c_step",ScaleMin和ScaleMax各包含两个确定的数值, 在这种情况下两个数值的第一个数值是Row方向的缩放, 第二个数值是Column方向的缩放。
- 另外在算子 determine_shape_model_params里面也有一些参数可以自动确定 (NumLevels, Optimization, Contrast, MinContrast)。如果这些参数不应该被自动确定, 它们就不应该出现在输入参数Parammeter里面, 他们需要有一个有效的数值且不能设置为"auto"。相对的,如果这些数值想要被自动确定, 它们应该遵循一下的规范:如果Optimization和Contrast需要被自动确定数值, 输入参数Parammeter里应该包含"Optimization"和"Contrast", 算子输入参数Optimization和Contrast的值会被忽略。相对的,如果最大的金字塔等级和最小对比度想要被自动确定,算子的输入参数Parameter应该包含"num_levels"和"min_contrast"。你可以让HALCON确定对应参数的合适的值,同时分别指定参数的上下限或范围:
- 如果要预先指定最大的金字塔等级,算子输入参数NumLevels需要指定一个确定的数值, 然后在算子输入参数Parameter里加上"num_levels",这样系统自动计算出来的金字塔等级最大不超过输入参数确定的NumLevels。如果算子输入参数NumLevels设置为"auto"而不是确定的数值, 那金字塔等级将没有限制,系统会尽可能自动取最大的金字塔等级。
- 如果要预先指定最小对比度, 算子输入参数Min Contrast需要指定一个确定的数值, 然后再算子输入参数Parameter里加上"min_contrast", 这样系统自动计算出来的最小对比度会大于等于输入的最小对比度。如果算子输入参数Min Contrast设置为"auto",那最小对比度将没有限制。
学习并认识Halcon算子
机翻英文的算子21/06/05