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

后端 未结 9 1038
长情又很酷
长情又很酷 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:32

    I did also face the same issue. I am running through command line python prompt in centos 7 with the following code

    >> import cv2, numpy as np
    >> cap=cv2.VideoCapture(0)
    >> img=cap.read()
    >> cap.release()
    >> cv2.imshow('image',img[1])
    >> cv2.waitKey(0)
    >> cv2.destroyAllWindows()
    >> cv2.waitKey(1)
    

    Even then the problem persisted and didn't solve. So I added

    >> cv2.imshow('image',img[1])
    

    Adding this did close the image window.Running the command again would create a new instance. Hope you can try if you still face any issues.

提交回复
热议问题