From 83e82c6632cd4d04b826dbbcebfdb3214df26222 Mon Sep 17 00:00:00 2001 From: jeongjae96 Date: Thu, 29 Sep 2022 23:33:15 +0900 Subject: [PATCH] =?UTF-8?q?[feat]=20=EA=B8=B0=EC=A1=B4=EC=97=90=20?= =?UTF-8?q?=EC=82=AC=EC=9A=A9=ED=95=98=EB=8D=98=20Yolo=20Annotation=20Tool?= =?UTF-8?q?=EC=97=90=20=ED=98=84=EC=9E=AC=20=EC=84=A0=ED=83=9D=EB=90=9C=20?= =?UTF-8?q?bbox=EB=A5=BC=20=EC=9E=98=20=EA=B5=AC=EB=B6=84=ED=95=A0=20?= =?UTF-8?q?=EC=88=98=20=EC=9E=88=EB=8A=94=20=EA=B8=B0=EB=8A=A5=20=EA=B5=AC?= =?UTF-8?q?=ED=98=84=20#90=20-=20=ED=8A=B9=EC=A0=95=20bbox=EB=A5=BC=20?= =?UTF-8?q?=EC=84=A0=ED=83=9D=ED=95=9C=20=ED=9B=84,=20spacebar=EB=A5=BC=20?= =?UTF-8?q?=EB=88=84=EB=A5=BC=20=EC=8B=9C=20=EC=83=89=EC=83=81=EC=9D=84=20?= =?UTF-8?q?=EB=B3=80=ED=95=98=EB=8F=84=EB=A1=9D=20=ED=95=98=EC=97=AC=20?= =?UTF-8?q?=EA=B5=AC=EB=B6=84=ED=95=A0=20=EC=88=98=20=EC=9E=88=EB=8F=84?= =?UTF-8?q?=EB=A1=9D=20=ED=95=9C=EB=8B=A4.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../yolo_annotation_tool/main.py | 27 +++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/blood_detection/yolov5/custom_dataset/yolo_annotation_tool/main.py b/blood_detection/yolov5/custom_dataset/yolo_annotation_tool/main.py index 8506781..64758c4 100644 --- a/blood_detection/yolov5/custom_dataset/yolo_annotation_tool/main.py +++ b/blood_detection/yolov5/custom_dataset/yolo_annotation_tool/main.py @@ -71,9 +71,9 @@ def __init__(self, master): self.STATE['x'], self.STATE['y'] = 0, 0 # reference to bbox - self.bboxIdList = [] + self.bboxIdList = [] # rectangle(bbox) object self.bboxId = None - self.bboxList = [] + self.bboxList = [] # bbox coordinates self.bboxListCls = [] self.hl = None self.vl = None @@ -123,6 +123,11 @@ def __init__(self, master): self.lb1.grid(row = 2, column = 2, sticky = W+N,columnspan=2) self.listbox = Listbox(self.frame, width = 30, height = 12) self.listbox.grid(row = 3, column = 2, sticky = N,columnspan=2) + + # 선택된 bbox 표시하는 기능 추가 + self.listbox.bind("", self.selBbox) # Bounding boxes의 요소를 클릭한 상태로 spacebar를 누르면 bbox가 magenta로 색상 변경. + self.listbox.bind("", self.deselBbox) # speacebar를 떼면 bbox가 원래 색상으로 변경. + self.btnDel = Button(self.frame, text = 'Delete', command = self.delBBox) self.btnDel.grid(row = 4, column = 2, sticky = W+E+N,columnspan=2) self.btnClear = Button(self.frame, text = 'ClearAll', command = self.clearBBox) @@ -323,6 +328,24 @@ def clearBBox(self): self.bboxList = [] self.bboxListCls = [] + def selBbox(self, event): + sel = self.listbox.curselection() + + if len(sel) != 1: + return + + idx = int(sel[0]) + self.mainPanel.itemconfig(self.bboxIdList[idx], outline='magenta') + + def deselBbox(self, event): + sel = self.listbox.curselection() + + if len(sel) != 1: + return + + idx = int(sel[0]) + self.mainPanel.itemconfig(self.bboxIdList[idx], outline=COLORS[int(self.bboxListCls[idx])]) + def prevImage(self, event = None): self.saveImage() if self.cur > 1: