@@ -617,7 +617,8 @@ def CVShowKeypointsBoxes(img_path, keypoints, bboxes=[], scores=[], waitkey=1):
617617
618618
619619#opencv显示boxes
620- def CVShowBoxes (image ,boxes ,label_texts ,scores ,label_ids = None ,num_classes = 90 ,waitkey = - 1 ,named_windows = "result" ):
620+ def CVShowBoxes (image ,boxes ,label_texts ,scores ,label_ids = None ,num_classes = 90 ,waitkey = - 1 ,named_windows = "result" ,lineType = 3 ):
621+
621622 base = int (np .ceil (pow (num_classes , 1. / 3 )))
622623 colors = [_to_color (x ) for x in range (num_classes )]
623624 if type (image ) == str :
@@ -635,7 +636,7 @@ def CVShowBoxes(image,boxes,label_texts,scores,label_ids=None,num_classes=90,wai
635636 xmax = int (boxes [i ][2 ])
636637 ymax = int (boxes [i ][3 ])
637638 if boxes is not None :
638- image2 = cv2 .rectangle (image2 , (xmin , ymin ), (xmax , ymax ), GetRandomColor (), 3 , 3 )
639+ image2 = cv2 .rectangle (image2 , (xmin , ymin ), (xmax , ymax ), GetRandomColor (), lineType , lineType )
639640 if label_texts is not None :
640641 if scores is not None :
641642 image2 = Add_Chinese_Label (img = image2 , label = label_texts [i ] + ":" + str (int (scores [i ] * 100 )),
@@ -644,9 +645,9 @@ def CVShowBoxes(image,boxes,label_texts,scores,label_ids=None,num_classes=90,wai
644645 image2 = Add_Chinese_Label (img = image2 , label = label_texts [i ],
645646 pt1 = (xmin , ymin ))
646647 if label_ids is not None :
647- image2 = cv2 .rectangle (image2 , (xmin , ymin ), (xmax , ymax ), colors [int (label_ids [i ])], 3 , 3 )
648+ image2 = cv2 .rectangle (image2 , (xmin , ymin ), (xmax , ymax ), colors [int (label_ids [i ])], lineType , lineType )
648649 else :
649- image2 = cv2 .rectangle (image2 , (xmin , ymin ), (xmax , ymax ), GetRandomColor (), 3 , 3 )
650+ image2 = cv2 .rectangle (image2 , (xmin , ymin ), (xmax , ymax ), GetRandomColor (), lineType , lineType )
650651
651652
652653 if waitkey >= 0 :
0 commit comments