@@ -88,9 +88,9 @@ def increase_index(current_index, last_index):
88
88
return current_index
89
89
90
90
91
- def draw_line (img , x , y , height , width ):
92
- cv2 .line (img , (x , 0 ), (x , height ), ( 0 , 255 , 255 ) , thickness = args .cross_thickness )
93
- cv2 .line (img , (0 , y ), (width , y ), ( 0 , 255 , 255 ) , thickness = args .cross_thickness )
91
+ def draw_line (img , x , y , height , width , color ):
92
+ cv2 .line (img , (x , 0 ), (x , height ), color , thickness = args .cross_thickness )
93
+ cv2 .line (img , (0 , y ), (width , y ), color , thickness = args .cross_thickness )
94
94
95
95
96
96
def yolo_format (class_index , point_1 , point_2 , width , height ):
@@ -352,6 +352,7 @@ def draw_info_bb_selected(tmp_img):
352
352
if not os .path .exists (bb_dir ):
353
353
os .makedirs (bb_dir )
354
354
355
+ color = class_rgb [class_index ].tolist ()
355
356
# loop
356
357
while True :
357
358
# clone the img
@@ -361,7 +362,7 @@ def draw_info_bb_selected(tmp_img):
361
362
# draw edges
362
363
tmp_img = draw_edges (tmp_img )
363
364
# draw vertical and horizong yellow guide lines
364
- draw_line (tmp_img , mouse_x , mouse_y , height , width )
365
+ draw_line (tmp_img , mouse_x , mouse_y , height , width , color )
365
366
img_path = image_list [img_index ]
366
367
txt_path = get_txt_path (img_path )
367
368
# draw already done bounding boxes
@@ -409,6 +410,8 @@ def draw_info_bb_selected(tmp_img):
409
410
# change up current class key listener
410
411
elif pressed_key == ord ('w' ):
411
412
class_index = increase_index (class_index , last_class_index )
413
+ color = class_rgb [class_index ].tolist ()
414
+ draw_line (tmp_img , mouse_x , mouse_y , height , width , color )
412
415
cv2 .setTrackbarPos (TRACKBAR_CLASS , WINDOW_NAME , class_index )
413
416
414
417
# help key listener
0 commit comments