两种方法,对显示的图片窗口关闭或最大化。
import cv2
img = cv2.imread('images/1.jpg')
## way1: can change the shape of the window and close the window
#cv2.namedWindow('result',0)
#cv2.startWindowThread()
#cv2.imshow('result',img)
#cv2.waitKey(0)
#cv2.destroyAllWindows()
## way2: can close the window
## can not change the shape of the window
cv2.imshow('result.jpg',img)
cv2.waitKey(0)
cv2.destroyAllWindows()
cv2.waitKey(1)
cv2.waitKey(1)
cv2.waitKey(1)
cv2.waitKey(1)
本文介绍了使用OpenCV库处理图片并展示两种不同的窗口显示方式:一种允许改变窗口大小及关闭;另一种仅能关闭但不支持调整窗口大小。通过具体代码示例展示了这两种方法的应用。
2万+

被折叠的 条评论
为什么被折叠?



