Exemplo n.º 1
0
 def getColor(self):
     if self.size == 1:
         l, w = self.heavierLabel()
         return colors.getColor(MultiLabelVoxel.colorFromLabel(l))
     else:
         if self.containsLabel(-1):
             # l, w = self.heavierLabel()
             # if l == -1:
             return colors.getColor(MultiLabelVoxel.colorFromLabel(-1))
             # else:
             #     return colors.getColor(MultiLabelVoxel.colorFromLabel(l))
         else:
             return (0, 0, 0)
Exemplo n.º 2
0
    def getColorByLabel(label, output_type="BGR"):
        if label not in TrainingClass.CLASSES_COLOR_MAP:
            label = label % len(TrainingClass.CLASSES_COLOR_MAP)

        name = TrainingClass.CLASSES_COLOR_MAP[label]
        return colors.getColor(name=name, out_type=output_type)
Exemplo n.º 3
0
 def drawLabel(self, image, label, color=colors.getColor('green')):
     height = 40
     width = 150
     cv2.rectangle(image, (0, 0), (width, height), color, -1)
     cv2.putText(image, label, (10, height - 10),
                 cv2.FONT_HERSHEY_SIMPLEX, 0.7, (255, 255, 255), 2)