31.9、几何定位---实例四(xld模板)
目标:根据几何定位定位出下图葡萄的个数
read_image (Image, 'C:/葡萄.bmp')
draw_spoke (Image, Regions, 3600, 15, 20, 10, ROIRows, ROICols, Direct)
spoke (Image, Regions1, 15, 20, 10, 1, 20, 'positive', 'first', ROIRows, ROICols, Direct, ResultRow, ResultColumn, ArcType)
pts_to_best_circle (Circle, ResultRow, ResultColumn, 5, 'circle', RowCenter, ColCenter, Radius, StartPhi, EndPhi, PointOrder)
create_shape_model_xld (Circle, 'auto', rad(-180), rad(360), 'auto', 'auto', 'ignore_local_polarity', 5, ModelID)
get_shape_model_contours (ModelContours, ModelID, 1)
find_shape_model (Image, ModelID, rad(-180), rad(360), 0.5, 30, 0.7, 'least_squares', 0, 0.9, Row, Column, Angle, Score)
*注:重叠度设置0.9看效果
if(|Score|>0)
dev_display_shape_matching_results (ModelID, 'red', Row, Column, Angle, 1, 1, 0)
endif