Skip to content

Commit d433359

Browse files
committed
find matches return empty df with proper column names
1 parent 19c70b6 commit d433359

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

MTM/__init__.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,11 @@ def findMatches(listTemplates, image, method=cv2.TM_CCOEFF_NORMED, N_object=floa
140140
# append to list of potential hit before Non maxima suppression
141141
listHit.append(newHit)
142142

143-
return pd.DataFrame(listHit) # All possible hits before Non-Maxima Supression
144-
143+
if listHit:
144+
return pd.DataFrame(listHit) # All possible hits before Non-Maxima Supression
145+
else:
146+
return pd.DataFrame(columns=["TemplateName", "BBox", "Score"])
147+
145148

146149
def matchTemplates(listTemplates, image, method=cv2.TM_CCOEFF_NORMED, N_object=float("inf"), score_threshold=0.5, maxOverlap=0.25, searchBox=None):
147150
'''

0 commit comments

Comments
 (0)