Skip to content

Commit 695ad4d

Browse files
committed
Fix display of bbox color with gray images
1 parent 650b621 commit 695ad4d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

MTM/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,11 +139,11 @@ def matchTemplates(listTemplates, image, method=cv2.TM_CCOEFF_NORMED, N_object=f
139139
return bestHits
140140

141141

142-
def drawBoxes(img, listHit, boxThickness=2, boxColor=(255, 255, 00), showLabel=True, labelColor=(255, 255, 255) ):
142+
def drawBoxes(img, listHit, boxThickness=2, boxColor=(255, 255, 00), showLabel=True, labelColor=(255, 255, 0) ):
143143
"""
144144
Return a copy of the image with results of template matching drawn as yellow rectangle and name of the template on top
145145
"""
146-
outImage = img.copy()
146+
outImage = cv2.cvtColor(image, cv2.COLOR_GRAY2RGB) # convert to RGB to be able to show detections as color box on grayscale image
147147

148148
for hit in listHit:
149149
x,y,w,h = hit['BBox']

0 commit comments

Comments
 (0)