initial_tune
This commit is contained in:
14
segment_anything_ui/image_pixmap.py
Normal file
14
segment_anything_ui/image_pixmap.py
Normal file
@@ -0,0 +1,14 @@
|
||||
from PySide6.QtGui import QImage, QPixmap, QPainter, QPen
|
||||
from PySide6.QtCore import Qt
|
||||
|
||||
|
||||
class ImagePixmap(QPixmap):
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
|
||||
def set_image(self, image):
|
||||
if image.dtype == "uint8":
|
||||
image = image.astype("float32") / 255.0
|
||||
image = (image * 255).astype("uint8")
|
||||
image = QImage(image.data, image.shape[1], image.shape[0], QImage.Format_RGB888)
|
||||
self.convertFromImage(image)
|
||||
Reference in New Issue
Block a user