import cv2
#读取图片,opencv读取的是bgr,图片的shpae为(h,w,c)
img=cv2.imread("image.jpg",1)
#定义一个窗口
cv2.nameWidow("img",cv2.WINDOW_NORMAL)
#重设窗口大小,与原图片等比例等比例
new_height = 800 # 你可以根据需要设置一个新的高度
new_width = int(width * (new_height / height))
img_resized = cv2.resize(img, (new_width, new_height))
cv2.resizeWindow("img",600,400)
cv2.imshow("img",img_black)
cv2.waitKey(0)
cv2.destroyAllWindows()