Skip to content

Commit 82f708d

Browse files
committed
warn if mask not same dimensions or type than temp
1 parent 345dae3 commit 82f708d

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

MTM/__init__.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,10 @@ def computeScoreMap(template, image, method=cv2.TM_CCOEFF_NORMED, mask=None):
7171
# Check that mask has the same dimensions and type than template
7272
sameDimension = mask.shape == template.shape
7373
sameType = mask.dtype == template.dtype
74-
if not sameDimension and sameType: mask = None
74+
if not (sameDimension and sameType):
75+
mask = None
76+
warnings.warn("Mask does not have the same dimension or bit depth than the template.\n-> Ignoring mask.")
77+
7578

7679
# Compute correlation map
7780
return cv2.matchTemplate(template, image, method, mask=mask)

0 commit comments

Comments
 (0)