代码拉取完成,页面将自动刷新
import cv2
import numpy as np
from PyQt5.QtGui import *
import math
def cvimg_to_qtimg(cvimg):
cvimg = cvimg.astype(np.uint8)
height, width, channels = cvimg.shape[:3]
cvimg = cv2.cvtColor(cvimg, cv2.COLOR_BGR2RGB)
cvimg = QImage(cvimg.data, width, height, width * channels, QImage.Format_RGB888)
return cvimg
def resize_picture(img,width,height):
w = np.array(img).shape[1]
h = np.array(img).shape[0]
if w / width >= h / height:
ratio = w / width
else:
ratio = h / height
new_width = int(w / ratio)
new_height = int(h / ratio)
return new_width,new_height
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。