cv2.imshow()使内核崩溃 [英] cv2.imshow() crashes Kernel
问题描述
我正在通过Jupyter Notebook运行OpenCV,每当我尝试运行cv2.imshow()时,内核崩溃,没有错误消息或有用的提示-只是一个简单的
I am running OpenCV through Jupyter Notebooks and whenever I try to run cv2.imshow() the kernel crashes, no error message or helpful hint - just a plain
The Kernel appears to have died. It will restart automatically.
这是我正在运行的代码...
Here is the code I am running...
import cv2
input = cv2.imread('images/input.jpg')
cv2.imshow('Hello World', input)
cv2.waitKey(0)
cv2.destroyAllWindows()
当我运行以下代码时,代码工作(尽管有所不同)...
The code works (albeit differently) when I run the below...
%matplotlib inline
from matplotlib import pyplot as plt
import cv2
image = cv2.imread('images/input.jpg')
plt.imshow(image)
plt.show()
仅供参考,我正在使用AWS上完全不变的BitFusion副本.
FYI I am using a completely unaltered copy of BitFusion on AWS.
https://aws.amazon.com/marketplace/pp/B01EYKBEQ0? ref = cns_srchrow
有什么想法会出问题吗?
Any idea what could be going wrong?
推荐答案
我现在无法解释您的代码的行为,但是您可以使用以下代码来实现上述行为.
I can't explain the behavior of your code right now but you can use the below code to achieve the above behavior.
%matplotlib inline
from matplotlib import pyplot as plt
import cv2
image = cv2.imread('images/input.jpg')
plt.imshow(image)
plt.show()
这篇关于cv2.imshow()使内核崩溃的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!