def setImage(self, image): # Image self.image_orig = image self.image = image.copy() self.setPixmap(cv2pixmap(image)) # Marker self.markers = np.zeros(image.shape[:2], np.int32)
def paint(self, painter, option, widget=None): painter.drawPixmap(0, 0, cv2pixmap(self.image)) if self.prev_pt is not None and self.pt[0] >= 0 and self.pt[1] >= 0: cv2.line(self.image, self.prev_pt, self.pt, self.color, 5) cv2.line(self.markers, self.prev_pt, self.pt, self.get_marker(), 5) if autoUpdate: comm.markerUpdated.emit(self.markers) self.prev_pt = self.pt
def __init__(self, parent=None, image=None): super(ImageDrawPanel, self).__init__() self.parent = parent # Image self.image_orig = image self.image = image.copy() self.setPixmap(cv2pixmap(image)) # Color self.color = RED # Points self.prev_pt = None self.pt = None # Marker self.markers = np.zeros(image.shape[:2], np.int32) # Signal slots comm.reset.connect(self.reset) comm.setColor.connect(self.setColor)