Skip to content

Commit 46e3396

Browse files
committed
* CVShowBoxes支持线条尺寸参数
1 parent 00abe0c commit 46e3396

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

CONTRIBUTING.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
11
### 更新日志
22

33

4-
#### OpencvToolsV1.2.6 - 2023-03-13
5-
* 新增图片文件转base64方法
4+
#### OpencvToolsV1.2.7 - 2023-03-13
5+
* CVShowBoxes支持线条尺寸参数
66
---
77

88
<details onclose>
99
<summary>查看更多更新日志</summary>
1010

11+
#### OpencvToolsV1.2.6 - 2023-03-13
12+
* 新增图片文件转base64方法
13+
---
14+
1115
#### OpencvToolsV1.2.5 - 2023-03-13
1216
* 自动打包并发布
1317
---

opencv_tools/jade_visualize.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)