可形变模板匹配主要用到两个算子
1.创建模板
- create_planar_uncalib_deformable_model(Template : : NumLevels, AngleStart, AngleExtent, AngleStep, ScaleRMin, ScaleRMax, ScaleRStep, ScaleCMin, ScaleCMax, ScaleCStep, Optimization, Metric, Contrast, MinContrast, GenParamName,GenParamValue : ModelID)
Description
The operator create_planar_uncalib_deformable_model prepares a template, which is passed in the image Template, as a deformable model used for uncalibrated perspective matching. The ROI of the model is passed as the domain of Template.
2.模板匹配
- find_planar_uncalib_deformable_model(Image : : ModelID, AngleStart, AngleExtent, ScaleRMin, ScaleRMax, ScaleCMin, ScaleCMax, MinScore, NumMatches, MaxOverlap, NumLevels,Greediness, GenParamName, GenParamValue : HomMat2D, Score)
Description
The operator find_planar_uncalib_deformable_model finds the best NumMatches instances of the perspectively distorted deformable model ModelID in the input image Image. The model must have been created previously by calling create_planar_uncalib_deformable_model or read_deformable_model.
3.模板匹配主要参数说明
Image (input_object) (multichannel-)image → object (byte / uint2)
Input image in which the model should be found.
ModelID (input_control) deformable_model → (integer)
Handle of the model.
AngleStart (input_control) angle.rad → (real)
Smallest rotation of the model.
Default value: -0.39
Suggested values: -3.14, -1.57, -0.79, -0.39, -0.20, 0.0
AngleExtent (input_control) angle.rad → (real)
Extent of the rotation angles.
Default value: 0.78
Suggested values: 6.29, 3.14, 1.57, 0.79, 0.39, 0.0
Restriction: AngleExtent >= 0
ScaleRMin (input_control) number → (real)
Minimum scale of the model in row direction.
Default value: 1.0
Suggested values: 0.5, 0.6, 0.7, 0.8, 0.9, 1.0
Restriction: ScaleRMin > 0
ScaleRMax (input_control) number → (real)
Maximum scale of the model in row direction.
Default value: 1.0
Suggested values: 1.0, 1.1, 1.2, 1.3, 1.4, 1.5
Restriction: ScaleRMax >= ScaleRMin
ScaleCMin (input_control) number → (real)
Minimum scale of the model in column direction.
Default value: 1.0
Suggested values: 0.5, 0.6, 0.7, 0.8, 0.9, 1.0
Restriction: ScaleCMin > 0
ScaleCMax (input_control) number → (real)
Maximum scale of the model in column direction.
Default value: 1.0
Suggested values: 1.0, 1.1, 1.2, 1.3, 1.4, 1.5
Restriction: ScaleCMax >= ScaleCMin
MinScore (input_control) real → (real)
Minimum score of the instances of the model to be found.
Default value: 0.5
Suggested values: 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0
Typical range of values: 0 ≤ MinScore ≤ 1
Minimum increment: 0.01
Recommended increment: 0.05
NumMatches (input_control) integer → (integer)
Number of instances of the model to be found (or 0 for all matches).
Default value: 1
Suggested values: 0, 1, 2, 3, 4, 5, 10, 20
MaxOverlap (input_control) real → (real)
Maximum overlap of the instances of the model to be found.
Default value: 1.0
Suggested values: 0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0
Typical range of values: 0 ≤ MaxOverlap ≤ 1
Minimum increment: 0.01
Recommended increment: 0.05
NumLevels (input_control) integer(-array) → (integer)
Number of pyramid levels used in the matching (and lowest pyramid level to use if |NumLevels| = 2).
Default value: 0
List of values: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10
Greediness (input_control) real → (real)
“Greediness” of the search heuristic (0: safe but slow; 1: fast but matches may be missed).
Default value: 0.9
Suggested values: 0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0
Typical range of values: 0 ≤ Greediness ≤ 1
Minimum increment: 0.01
Recommended increment: 0.05
GenParamName (input_control) string-array → (string)
The general parameter names.
Default value: []
List of values: [], 'angle_change_restriction', 'angle_step', 'aniso_scale_change_restriction', 'scale_c_step', 'scale_r_step', 'subpixel'
GenParamValue (input_control) integer-array → (integer / real / string)
Values of the general parameters.
Default value: []
List of values: [], 'least_squares', 'least_squares_high', 'least_squares_very_high', 'none'
HomMat2D (output_control) hom_mat2d(-array) → (real)
Homographies between model and found instances.
Score (output_control) real-array → (real)
Score of the found instances of the model.
4.模板匹配相关算子
read_image 读取图像
gen_cam_par_area_scan_division 设置相机参数模型
create_planar_uncalib_deformable_model 创建模板
set_deformable_model_origin 设置模板坐标原点
get_deformable_model_contours 获取模板轮廓
find_planar_uncalib_deformable_model 模板匹配
projective_trans_contour_xld 轮廓投影变换
projective_trans_pixel 投影坐标原点
vector_to_pose 计算出世界坐标和图像坐标之间的点对应的绝对位姿
disp_3d_coord_system 显示模板原点坐标系
5.模板匹配测试
设置ROI,制作模板
测试图像