Python OpenCV - waitKey(0) does not respond?

后端 未结 12 938
忘掉有多难
忘掉有多难 2020-12-29 02:58

I\'m using opencv 2.4.7 on ubuntu 12.04. I\'m programming with python and I have a problem when i run this script:

import cv2

img = cv2.imread(\'34762092361         


        
12条回答
  •  灰色年华
    2020-12-29 03:26

    There is a problem with unix based system running opencv programs from python notebooks.

    Check this alternate method My suggestion is to run code in python in terminal. You will not face any kind of problem

    Copy the same code and save with filename.py

    import cv2
    input = cv2.imread('path_to_image.png')
    cv2.imshow('Hello World', input)
    cv2.waitKey(0)
    cv2.destroyAllWindows()
    

    then open specific directory and then open terminal

    Steps:

    Open Terminal
    cd path/to/filename.py
    source activate YOURPROFILE 
    python filename.py
    

    This will solve problem

    https://youtu.be/8O-FW4Wm10s

提交回复
热议问题