You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This function searches each template in the image, and return the best N_object location which offer the best scores and which do not overlap above the `maxOverlap` threshold.
17
+
18
+
__Parameters__
19
+
-_listTemplates_:
20
+
list of tuples (LabelString, Grayscale or RGB numpy array) templates to search in each image, associated to a label
21
+
22
+
-_image_ : Grayscale or RGB numpy array
23
+
image in which to perform the search, it should be the same bitDepth and number of channels than the templates
24
+
25
+
-_method_ : int
26
+
one of OpenCV template matching method (0 to 5), default 5=0-mean cross-correlation
27
+
28
+
-_N_object_: int
29
+
expected number of objects in the image
30
+
31
+
- score_threshold: float in range [0,1]
32
+
if N>1, returns local minima/maxima respectively below/above the score_threshold
33
+
34
+
-_maxOverlap_: float in range [0,1]
35
+
This is the maximal value for the ratio of the Intersection Over Union (IoU) area between a pair of bounding boxes.
36
+
If the ratio is over the maxOverlap, the lower score bounding box is discarded.
37
+
38
+
-_searchBox_ : tuple (X, Y, Width, Height) in pixel unit
39
+
optional rectangular search region as a tuple
40
+
41
+
__Returns__
42
+
-_bestHits_:list of match as dictionaries {"TemplateName":string, "BBox":(X, Y, Width, Height), "Score":float}
43
+
if N=1, return the best matches independently of the score_threshold
44
+
if N<inf, returns up to N best matches that passed the score_threshold
45
+
if N=inf, returns all matches that passed the score_threshold
46
+
47
+
48
+
The function `findMatches` performs the same detection without the Non-Maxima Supression.
49
+
50
+
## drawBoxes
51
+
The 2nd important function is `drawBoxes` to display the detections as rectangular bounding boxes on the initial image.
This function returns a copy of the image with predicted template locations as bounding boxes overlaid on the image
55
+
The name of the template can also be displayed on top of the bounding boxes with showLabel=True.
56
+
57
+
__Parameters__
58
+
-_image_ : numpy array
59
+
image in which the search was performed
60
+
61
+
-_listHit_ :
62
+
list of hit as returned by matchTemplates or findMatches
63
+
64
+
-_boxThickness_: int
65
+
thickness of bounding box contour in pixels
66
+
67
+
-_boxColor_: (int, int, int)
68
+
RGB color for the bounding box
69
+
70
+
-_showLabel_: Boolean
71
+
Display label of the bounding box (field TemplateName)
72
+
73
+
-_labelColor_: (int, int, int)
74
+
RGB color for the label
75
+
76
+
__Returns__
77
+
-_outImage_: RGB image
78
+
original image with predicted template locations depicted as bounding boxes
79
+
80
+
# Examples
11
81
Check out the [jupyter notebook tutorial](https://github.com/LauLauThom/Multi-Template-Matching/blob/master/Tutorial.ipynb) for some example of how to use the package.
12
82
The [wiki](https://github.com/LauLauThom/MultiTemplateMatching/wiki) section of this related repository also provides some information about the implementation.
0 commit comments