Python Opencv destroyWindow() 函数用于关闭特定窗口。该函数采用一个参数,即您要关闭或销毁的窗口名称,并且它不返回任何内容。
用法:cv2.destroyWindow(window_name)
参数:
- window_name: 您要销毁的窗口的名称
返回:该函数不返回任何内容
destroyWindow() 函数 - 示例
在此示例中,我们将读取一张图像并为其创建多个窗口。然后我们将使用 destroyWindow() 函数销毁任何特定窗口。
Python3
# import cv2 library
import cv2
# Read an image
img = cv2.imread("Documents/Image3.jpg",
cv2.IMREAD_COLOR)
# create two windows of images and
# give different window name to each
cv2.imshow("I1", img)
cv2.imshow("I2", img)
# we will wait for user to press any key
cv2.waitKey(0)
# after user pressed any key only 'I2' named
# window will be closed and another image
# remains as it is.
cv2.destroyWindow("I2")
输出:
相关用法
- Python OpenCV destroyAllWindows()用法及代码示例
- Python OpenCV drawKeypoints()用法及代码示例
- Python OpenCV drawMatchesKnn()用法及代码示例
- Python OpenCV distanceTransform()用法及代码示例
- Python OpenCV cv2.circle()用法及代码示例
- Python OpenCV cv2.blur()用法及代码示例
- Python OpenCV cv2.ellipse()用法及代码示例
- Python OpenCV cv2.cvtColor()用法及代码示例
- Python OpenCV cv2.copyMakeBorder()用法及代码示例
- Python OpenCV cv2.imread()用法及代码示例
- Python OpenCV cv2.imshow()用法及代码示例
- Python OpenCV cv2.imwrite()用法及代码示例
- Python OpenCV cv2.putText()用法及代码示例
- Python OpenCV cv2.rectangle()用法及代码示例
- Python OpenCV cv2.arrowedLine()用法及代码示例
- Python OpenCV cv2.erode()用法及代码示例
- Python OpenCV cv2.line()用法及代码示例
- Python OpenCV cv2.flip()用法及代码示例
- Python OpenCV cv2.transpose()用法及代码示例
- Python OpenCV cv2.rotate()用法及代码示例
- Python OpenCV cv2.polylines()用法及代码示例
- Python OpenCV Canny()用法及代码示例
- Python OpenCV Filter2D()用法及代码示例
- Python OpenCV getgaussiankernel()用法及代码示例
- Python OpenCV getRotationMatrix2D()用法及代码示例
注:本文由纯净天空筛选整理自patildhanu4111999大神的英文原创作品 Python OpenCV – destroyWindow() Function。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。