简体   繁体   中英

Spyder doesn't show image with OpenCV

I am just trying to perform the easiest task in opencv library which is opening and showing an image. I was doing it before on windows computer and it was working perfectly, however when I try to perform the same task on my MacBook it doesn't work. The code is simple:

import cv2

img = cv2.imread('/Users/michalsniady/Desktop/IFE/4th semester/Image Processing And Computer Graphics/nature.jpg', 1)

cv2.imshow('window', img)
cv2.waitKey(10000)
cv2.destroyAllWindows()

When I was downloading opencv I used simply pip install opencv-python if I recall correctly. Maybe the version is wrong? I'm using Python 3.7.6

When I run this program it has two outcomes: - kernel died - nothing happens I am using Spyder with Anaconda

Thank you for any help.

I faced somewhat similar issues. I reinstalled my open CV and then it worked correctly!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM