31.12、几何定位---实例七(缩放)
目标:用几何定位尽可能定位下图的葡萄
read_image (Image, 'C:/葡萄.bmp')
*拟合圆形
draw_spoke (Image, Regions, 3600, 30, 60, 15, ROIRows, ROICols, Direct)
spoke (Image, Regions1, 30, 60, 15, 1, 20, 'positive', 'first', ROIRows, ROICols, Direct, ResultRow, ResultColumn, ArcType)
pts_to_best_circle (Circle2, ResultRow, ResultColumn, 5, 'circle', RowCenter, ColCenter, Radius2, StartPhi, EndPhi, PointOrder)
*不支持缩放
create_shape_model_xld (Circle2, 'auto', rad(-10), rad(20), 'auto', 'auto', 'ignore_local_polarity', 5, ModelID)
get_shape_model_contours (ModelContours, ModelID, 1)
find_shape_model (Image, ModelID, rad(-10), rad(20), 0.5, 30, 0.5, 'least_squares', 0, 0.9, Row2, Column2, Angle, Score)
dev_display_shape_matching_results (ModelID, 'red', Row2, Column2, Angle, 1, 1, 0)
*支持同步缩放
create_scaled_shape_model_xld (Circle2, 'auto', rad(-10), rad(20), 'auto', 0.6, 1.4, 'auto', 'auto', 'ignore_local_polarity', 5, ModelID1)
get_shape_model_contours (ModelContours1, ModelID1, 1)
find_scaled_shape_model (Image, ModelID1, rad(-10), rad(20), 0.6, 1.4, 0.7, 30, 0.5, 'least_squares', 0, 0.5, Row3, Column3, Angle1, Scale, Score1)
dev_display_shape_matching_results (ModelID1, 'red', Row3, Column3, Angle1, 1, 1, 0)
*支持异步缩放
create_aniso_shape_model_xld (Circle2, 'auto', rad(-10), rad(20), 'auto', 0.6, 1.4, 'auto', 0.6, 1.4, 'auto', 'auto', 'ignore_local_polarity', 5, ModelID2)
get_shape_model_contours (ModelContours2, ModelID2, 1)
find_aniso_shape_model (Image, ModelID2, rad(-10), rad(20), 0.6, 1.4, 0.6, 1.4, 0.7, 30, 0.5, 'least_squares', 0, 0.3, Row4, Column4, Angle2, ScaleR, ScaleC, Score2)
dev_display_shape_matching_results (ModelID2, 'red', Row4, Column4, Angle2, 1, 1, 0)