update 更新界面显示

This commit is contained in:
FrankCV2048
2024-09-12 23:36:01 +08:00
parent 176a7b38ce
commit 20feaecbbe
9 changed files with 2654 additions and 1473 deletions

11
Util/util_pic.py Normal file
View File

@ -0,0 +1,11 @@
import cv2
from PIL.ImageQt import QImage, QPixmap
def cv2_to_qpixmap(cv_img):
"""将OpenCV图像转换为QPixmap"""
cv_img = cv2.cvtColor(cv_img, cv2.COLOR_BGR2RGB)
height, width, channel = cv_img.shape
bytes_per_line = 3 * width
q_img = QImage(cv_img.data, width, height, bytes_per_line, QImage.Format_RGB888)
return QPixmap.fromImage(q_img)