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。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。