cv2.imshow() function is opening a window that always says not responding - python opencv

后端 未结 9 1054
长情又很酷
长情又很酷 2020-12-13 17:54

I am trying to run a very simple program. To open and jpg file and display it using the opencv library for python. Initially it all worked fine but now it just opens a windo

9条回答
  •  猫巷女王i
    2020-12-13 18:35

    None of the answers here worked in MacOS. The following works:

    Just add a cv2.waitKey(1) after cv2.destroyAllWindows().

    Example:

    import cv2
    image = cv2.imread('my_image.jpg')
    cv2.imshow('HSV image', hsv_image); cv2.waitKey(0); cv2.destroyAllWindows(); cv2.waitKey(1)
    

提交回复
热议问题