[Turn] explore operator find

 

Shape-based template search operator:

find_shape_model(Image : : ModelID, AngleStart, AngleExtent, MinScore, NumMatches, MaxOverlap, SubPixel, NumLevels, Greediness : Row, Column, Angle, Score)

 

MaxOverlap: means the maximum overlap area allowed.

 

So we want to ask, which region does this overlapping region refer to?

If the following image is an image of creating a shape model:

So for the picture below, do the two shapes overlap?

 

According to general understanding, it is clear that there is no overlap, just one just inserted into the gap of the other, but the two shapes seem to have no substantial overlap.

 

After looking at some information, it is said that the overlap here refers to the overlapping part of the smallest circumscribed rectangle of each shape . That is the red color block in the figure below:

If this is the case, let me verify:

1 * model 01.png FIG. 1 is the first article, 02.png FIG. 2 is a second article 2 read_image (Image_mode, ' C: / the Users / Happy xia / Desktop / 01.png ' ) . 3 create_shape_model (Image_mode, ' auto ' , -3.0 , 6.79 , ' auto ' , ' auto ' , ' use_polarity ' , ' auto ' , ' auto ' , ModelID2) 4  5 * Verification 6 read_image (Image, 'C:/Users/happy xia/Desktop/02.png') 7 dev_set_draw ('margin') 8 binary_threshold (Image, Region, 'max_separability', 'dark', UsedThreshold) 9 connection (Region, ConnectedRegions)10 smallest_rectangle2 (ConnectedRegions, Row, Column, Phi, Length1, Length2)11 gen_rectangle2 (Rectangle, Row, Column, Phi, Length1, Length2)12 select_obj (Rectangle, ObjectSelected, 1)13 select_obj (Rectangle, ObjectSelected1, 2)14  area_center (ObjectSelected1, Area1, Row11, Column11) 15  16  intersection (ObjectSelected, ObjectSelected1, RegionIntersection) 17  area_center (RegionIntersection, Area, Row1, Column1) 18  19 * (Area1 + 0.1 ) is to let the quotient be a decimal, otherwise the ratio Would be equal to 0 20  ratio: = Area / (Area1 + 0.1) 21 disp_message ( 3600 , ratio, ' image ' , 160 , 205 , ' red ' , ' true ' ) 22  23  dev_display (Image) 24  25* Note: The sixth parameter, NumMatchs = 0 , means that there is no limit to the number of matches. Multiple 26 find_shape_model (Image, ModelID2, -3.0 , 6.79 , 0.5 , 0 , ratio + 0.01 , ' least_squares ' , 0 , 0.9 , Row2, Column2, Angle2, Score2 ) 27  28 * get_shape_model_contours (ModelContours, ModelID2, 1 ) 29 * vector_angle_to_rigid ( 0 , 0 , 0 , Row2 [ 0 ], Column2 [ 0 ], Angle2 [ 0], HomMat2D0) 30 * affine_trans_contour_xld (ModelContours, ContoursAffinTrans0, HomMat2D0) 31  32 * vector_angle_to_rigid ( 0 , 0 , 0 , Row2 [ 1 ], Column2 [ 1 ], Angle2 [ 1 ], HomMat2D1, HomMat2D1) 33 * affine_trld HomMat2D1)

Here, the area ratio of the overlapping portion and the smallest circumscribed rectangle of a single shape is 0.426317.

When the parameter MaxOverlap in find_shape_model takes the value ratio + 0.01 (or ratio) , Score2 = [0.999136, 0.998544] .

When the parameter MaxOverlap in find_shape_model takes the value ratio-0.01 , Score2 = 0.999136 , that is, only one is found.

 

It can be explained from this: ratio (the value is 0.426317) is indeed the cut-off value of the maximum overlap ratio allowed in this example , and it can be determined that MaxOverlap in find_shape_model refers to the overlap of the smallest circumscribed rectangle of each shape. The proportion of the rectangle .

 



Guess you like

Origin www.cnblogs.com/dinghw/p/12678148.html