Python OpenCV - waitKey(0) does not respond?

后端 未结 12 908
忘掉有多难
忘掉有多难 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:17

    This code works for me from IDLE:

    # -*- coding: utf-8 -*-
    
    # Objectif : découvrir le fonctionnement d'opencv-python
    # http://opencv-python-tutroals.readthedocs.org/en/latest/index.html
    
    
    import numpy as np
    import cv2
    
    # Load an color image in grayscale
    img = cv2.imread('Lena.tiff',0)
    WINDOW_NAME = 'Image de Lena'
    cv2.namedWindow(WINDOW_NAME, cv2.CV_WINDOW_AUTOSIZE)
    cv2.startWindowThread()
    
    # Display an image
    cv2.imshow(WINDOW_NAME,img)
    cv2.waitKey(0) 
    
    
    cv2.destroyAllWindows()
    

    Hope this helps for future readers.

提交回复
热议问题