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
Search each template in the image, and return the best N_object location which offer the best score and which do not overlap
184
+
"""
185
+
Search each template in the image, and return the best N_object locations which offer the best score and which do not overlap above the maxOverlap threshold.
186
+
180
187
Parameters
181
188
----------
182
-
- listTemplates : list of tuples (LabelString, Grayscale or RGB numpy array)
183
-
templates to search in each image, associated to a label
189
+
- listTemplates : list of tuples (LabelString, template, mask (optional))
190
+
templates to search in each image, associated to a label
191
+
labelstring : string
192
+
template : numpy array (grayscale or RGB)
193
+
mask (optional): numpy array, should have the same dimensions and type than the template
194
+
184
195
- image : Grayscale or RGB numpy array
185
196
image in which to perform the search, it should be the same bitDepth and number of channels than the templates
197
+
186
198
- method : int
187
-
one of OpenCV template matching method (1 to 5), default 5=0-mean cross-correlation
188
-
method 0 is not supported (no NMS implemented for non-bound difference score), use 1 instead
189
-
- N_object: int
190
-
expected number of objects in the image
199
+
one of OpenCV template matching method (1 to 5), default 5=0-mean cross-correlation
200
+
method 0 is not supported (no NMS implemented for non-bound difference score), use 1 instead
201
+
202
+
- N_object: int or foat("inf")
203
+
expected number of objects in the image, default to infinity if unknown
204
+
191
205
- score_threshold: float in range [0,1]
192
206
if N>1, returns local minima/maxima respectively below/above the score_threshold
207
+
193
208
- maxOverlap: float in range [0,1]
194
209
This is the maximal value for the ratio of the Intersection Over Union (IoU) area between a pair of bounding boxes.
195
210
If the ratio is over the maxOverlap, the lower score bounding box is discarded.
211
+
196
212
- searchBox : tuple (X, Y, Width, Height) in pixel unit
197
213
optional rectangular search region as a tuple
198
214
199
215
Returns
200
216
-------
201
217
Pandas DataFrame with 1 row per hit and column "TemplateName"(string), "BBox":(X, Y, Width, Height), "Score":float
202
218
if N=1, return the best matches independently of the score_threshold
203
-
if N<inf, returns up to N best matches that passed the score_threshold
204
-
if N=inf, returns all matches that passed the score_threshold
205
-
'''
219
+
if N<inf, returns up to N best matches that passed the NMS
220
+
if N=inf, returns all matches that passed the NMS
221
+
"""
206
222
ifmaxOverlap<0ormaxOverlap>1:
207
223
raiseValueError("Maximal overlap between bounding box is in range [0-1]")
0 commit comments