*形状匹配
find_shape_model (ImageEmphasize, ModelID, -0.39, 0.78, 0.5, 1, 0.5, 'least_squares', [4,-2], 0.9, Row, Column, Angle, Score)
*创建一个初始化矩阵
hom_mat2d_identity (HomMat2D)
*从点和角度计算刚性仿射变换,找出模板和卡尺工具的对应关系Phi
vector_angle_to_rigid (Row3, Column3, rad(0), Row, Column, Angle, HomMat2D)
affine_trans_point_2d (HomMat2D, [Row1,Row2],[Column1,Column2], Qx, Qy)
affine_trans_point_2d (HomMat2D, [Row11,Row12],[Column11,Column12], Qx1, Qy1)
*创建卡尺工具,设置参数
create_metrology_model (MetrologyHandle1)
create_metrology_model (MetrologyHandle2)
add_metrology_object_generic (MetrologyHandle1, 'line', [Qx[0],Qy[0],Qx[1],Qy[1]], 20, 5, 1, 30, [], [], Index1)
add_metrology_object_generic (MetrologyHandle2, 'line', [Qx1[0],Qy1[0],Qx1[1],Qy1[1]], 20, 5, 1, 30, [], [], Index2)
set_metrology_object_param (MetrologyHandle1, 0, 'measure_select', 'first')
set_metrology_object_param (MetrologyHandle2, 0, 'measure_select', 'last')
get_metrology_object_measures (Contours1, MetrologyHandle1, 'all', 'all', Row4, Column4)
get_metrology_object_measures (Contours2, MetrologyHandle2, 'all', 'all', Row6, Column6)
*寻找边缘,定位卡尺坐标,此坐标是个数组
apply_metrology_model (ImageEmphasize, MetrologyHandle1)
apply_metrology_model (ImageEmphasize, MetrologyHandle2)
get_metrology_object_measures (Contours3, MetrologyHandle1, 'all', 'all', Row5, Column5)
get_metrology_object_measures (Contours4, MetrologyHandle2, 'all', 'all', Row7, Column7)