Skip to content

Commit f72f69e

Browse files
committed
simpler if/else
1 parent d433359 commit f72f69e

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

MTM/__init__.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -179,9 +179,12 @@ def matchTemplates(listTemplates, image, method=cv2.TM_CCOEFF_NORMED, N_object=f
179179

180180
tableHit = findMatches(listTemplates, image, method, N_object, score_threshold, searchBox)
181181

182-
if method == 1: bestHits = NMS(tableHit, N_object=N_object, maxOverlap=maxOverlap, sortAscending=True)
182+
if method in (0,1):
183+
sortAscending = True
184+
else:
185+
sortAscending = False
183186

184-
elif method in (3,5): bestHits = NMS(tableHit, N_object=N_object, maxOverlap=maxOverlap, sortAscending=False)
187+
bestHits = NMS(tableHit, N_object=N_object, maxOverlap=maxOverlap, sortAscending=sortAscending)
185188

186189
return bestHits
187190

0 commit comments

Comments
 (0)