效果图:
代码:
import osfrom PyQt5.QtWidgets import QWidget, QApplication, QVBoxLayout, QPushButton, QLabel
from PyQt5.QtGui import QPainter, QPen, QColor, QImage, QPixmap
from PyQt5.QtCore import Qt, QPoint
import sys
import jsonclass ImageLabel(QLabel):def __init__(self, parent=None):super().__init__(parent)self.setMouseTracking(True)def mouseMoveEvent(self, event):super().mouseMoveEvent(event)class LineDrawer(QWidget):def __init__(self):super().__init__()self.drawing = Falseself.lines = [] # 存储所有的线self.start_point = QPoint()self.end_point = QPoint()# self.original_image = QImage(rf"F:\data\jupiter\det_no\train\1009\cc\0\0_1.00_100916_82853.jpg")self.original_im