import cv2 as cv
from matplotlib import pyplot as plt
img = cv.imread('1.jpg')
cv.imshow('hello',img)
#cv.waitKey(0)
#cv.destroyAllWindows()
cv.destroyWindow('hello')
下面的例子不能顯示圖片,顯示窗口爲灰色
Jupyter notebook中用cv2.imshow()不能顯示圖片的問題貌似網上沒什麼答案所以在此分享
如果想用cv2.imshow()方法要配合關閉窗口的方法
cv.destroyWindow('hello')
或者cv.destroyAllWindows()
我也是一個初學者,希望多多指教