Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix:Tflite detext error: cv2.error: OpenCV(4.5.2) 👎 error: (-5:Bad…… argument) in function 'rectangle' #59

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions core/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ def draw_bbox(image, bboxes, info = False, counted_classes = None, show_label=Tr

bbox_color = colors[class_ind]
bbox_thick = int(0.6 * (image_h + image_w) / 600)
c1, c2 = (coor[0], coor[1]), (coor[2], coor[3])
c1, c2 = (int(coor[0]), int(coor[1])), (int(coor[2]), int(coor[3]))
cv2.rectangle(image, c1, c2, bbox_color, bbox_thick)

if info:
Expand All @@ -255,9 +255,9 @@ def draw_bbox(image, bboxes, info = False, counted_classes = None, show_label=Tr
bbox_mess = '%s: %.2f' % (class_name, score)
t_size = cv2.getTextSize(bbox_mess, 0, fontScale, thickness=bbox_thick // 2)[0]
c3 = (c1[0] + t_size[0], c1[1] - t_size[1] - 3)
cv2.rectangle(image, c1, (np.float32(c3[0]), np.float32(c3[1])), bbox_color, -1) #filled
cv2.rectangle(image, c1, (int(c3[0]), int(c3[1])), bbox_color, -1) #filled

cv2.putText(image, bbox_mess, (c1[0], np.float32(c1[1] - 2)), cv2.FONT_HERSHEY_SIMPLEX,
cv2.putText(image, bbox_mess, (c1[0], int(c1[1] - 2)), cv2.FONT_HERSHEY_SIMPLEX,
fontScale, (0, 0, 0), bbox_thick // 2, lineType=cv2.LINE_AA)

if counted_classes != None:
Expand Down