@@ -155,16 +155,16 @@ def draw_bbox(image, bboxes, classes=read_class_names(cfg.YOLO.CLASSES), allowed
155
155
else :
156
156
bbox_color = colors [class_ind ]
157
157
bbox_thick = int (0.6 * (image_h + image_w ) / 600 )
158
- c1 , c2 = (coor [1 ], coor [0 ]), (coor [3 ], coor [2 ])
158
+ c1 , c2 = (int ( coor [1 ]), int ( coor [0 ])) , (int ( coor [3 ]), int ( coor [2 ]) )
159
159
cv2 .rectangle (image , c1 , c2 , bbox_color , bbox_thick )
160
160
161
161
if show_label :
162
162
bbox_mess = '%s: %.2f' % (classes [class_ind ], score )
163
163
t_size = cv2 .getTextSize (bbox_mess , 0 , fontScale , thickness = bbox_thick // 2 )[0 ]
164
164
c3 = (c1 [0 ] + t_size [0 ], c1 [1 ] - t_size [1 ] - 3 )
165
- cv2 .rectangle (image , c1 , (np .float32 (c3 [0 ]), np .float32 (c3 [1 ])), bbox_color , - 1 ) #filled
165
+ cv2 .rectangle (image , c1 , (int ( np .float32 (c3 [0 ])), int ( np .float32 (c3 [1 ]) )), bbox_color , - 1 ) #filled
166
166
167
- cv2 .putText (image , bbox_mess , (c1 [0 ], np .float32 (c1 [1 ] - 2 )), cv2 .FONT_HERSHEY_SIMPLEX ,
167
+ cv2 .putText (image , bbox_mess , (c1 [0 ], int ( np .float32 (c1 [1 ] - 2 ) )), cv2 .FONT_HERSHEY_SIMPLEX ,
168
168
fontScale , (0 , 0 , 0 ), bbox_thick // 2 , lineType = cv2 .LINE_AA )
169
169
return image
170
170
0 commit comments