labelImg中绘制的矩形框颜色和宽度的代码在libs.shape.py文件中
修改顶点的颜色:
DEFAULT_LINE_COLOR = QColor(255, 255, 255, 255)
DEFAULT_FILL_COLOR = QColor(0,255, 255, 255)
DEFAULT_SELECT_LINE_COLOR = QColor(0, 255, 255)
DEFAULT_SELECT_FILL_COLOR = QColor(255, 255, 0, 20) # 选择后填充的颜色
DEFAULT_VERTEX_FILL_COLOR = QColor(255, 0, 0, 255) # 顶点颜色
DEFAULT_HVERTEX_FILL_COLOR = QColor(255, 255, 255) # 顶点高亮的颜色
修改定点的大小
point_size = 2 # 顶点的大小
scale = 1.0
修改框的颜色以及宽度(QColor(0,0,255,128),其中128是透明度)
def paint(self, painter):
if self.points:
# color = self.select_line_color if self.selected else self.line_color
color = QColor(0,0,255,128) # 框的颜色
pen = QPen(color)
# Try using integer sizes for smoother drawing(?)
pen.setWidth(max(1, int(round(2.0 / self.scale)))) # 框的宽度
painter.setPen(pen)