update 更新命令发送错误,自由路径配置失误,图片显示实物
This commit is contained in:
@ -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"""
|
||||
|
||||
Reference in New Issue
Block a user