update 更新命令发送错误,自由路径配置失误,图片显示实物

This commit is contained in:
Gogs
2024-12-14 17:09:45 +08:00
parent 1efd0385e1
commit e2b60094b3
5 changed files with 115 additions and 82 deletions

View File

@ -1,13 +1,23 @@
import logging
import cv2
from PIL.ImageQt import QImage, QPixmap
from Util.util_log import log
def cv2_to_qpixmap(cv_img):
"""将OpenCV图像转换为QPixmap"""
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)
# img = cv_img.copy()
# cv_img = cv2.cvtColor(cv_img, cv2.COLOR_BGR2RGB)
try:
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)
except Exception as e:
log.log_message(logging.ERROR,e)
return None
# def cv2_to_qpixmap(cv_img):
# """将OpenCV图像转换为QPixmap"""