通过设置杂波,来准确定位要检测对象;
如下图中未设置杂波情况下,匹配结果如(3);如图(4)设置杂波后,匹配结果如图(5)
* * Create a shape model. *创建一个模型 read_image (ImageModel, '/bga_gap/bga_gap_01.png') gen_circle (ROI, 753.869, 551.624, 28.4027) reduce_domain (ImageModel, ROI, ImageReduced) create_aniso_shape_model (ImageReduced, 'auto', rad(0), rad(0), 'auto', 0.95, 1.05, 'auto', 0.95, 1.05, 'auto', 'auto', 'use_polarity', 'auto', 'auto', ModelID) * * Specify the clutter parameters. *指定待筛选杂波参数 find_aniso_shape_model (ImageModel, ModelID, rad(0), rad(0), 0.95, 1.05, 0.95, 1.05, 0.83, 0, 0.0, 'least_squares', 0, 0.0, Row, Column, Angle, ScaleR, ScaleC, Score) *获取匹配结果 get_hom_mat2d_from_matching_result (Row[0], Column[0], Angle[0], ScaleR[0], ScaleC[0], HomMat2D) * gen_circle (ROI_0, 700.655, 548.666, 21.6273) gen_circle (ROI_1_0, 810.655, 550.611, 21.6273) union2 (ROI_0, ROI_1_0, ClutterRegion) * ClutterContrast := 12 * * Set the clutter parameters into shape model. *查找模型设置杂波参数 set_shape_model_clutter (ClutterRegion, ModelID, HomMat2D, ClutterContrast, [], []) * * Use the shape model to detect objects with a small amount of clutter *使用形状模型检测具有少量杂波的对象 read_image (Image,'/bga_gap/bga_gap_02.png') MaxClutter := 0.09 find_aniso_shape_model (Image, ModelID, rad(0), rad(0), 0.95, 1.05, 0.95, 1.05, [0.83, MaxClutter], 0, 0.0, 'least_squares', [4, 3], 0.0, Row, Column, Angle, ScaleR, ScaleC, Score) * * Visualize the matches dev_display_shape_matching_results (ModelID, ['green', 'red'], Row, Column, Angle, ScaleR, ScaleC, 0) Clutter := Score[|Score|/2:|Score|-1] Score := Score[0:|Score|/2-1] dev_inspect_ctrl ([Score, Clutter])
标签:ROI,set,1.05,auto,shape,Score,clutter,model From: https://www.cnblogs.com/echo-efun/p/18071138