怎么opencv显示不了图片
为啥opencv2用python显示不了图片(交互式模式下)代码如下:
Python 3.8.7 (tags/v3.8.7:6503f05, Dec 21 2020, 17:59:51) on win32
Type "help", "copyright", "credits" or "license()" for more information.
>>> import cv2
>>> import matplotlib.pyplot as plt
>>> img = imread("D:/0.png",1)
Traceback (most recent call last):
File "<pyshell#2>", line 1, in <module>
img = imread("D:/0.png",1)
NameError: name 'imread' is not defined
>>> img = cv2.imread("D:/0.png",1)
>>> print(img.cheap)
Traceback (most recent call last):
File "<pyshell#4>", line 1, in <module>
print(img.cheap)
AttributeError: 'numpy.ndarray' object has no attribute 'cheap'
>>> plt.imshow(img)
<matplotlib.image.AxesImage object at 0x000001BC96A11A90>
>>>
(不知道为啥,网上找过几个方法也不行,我记得小甲鱼就是用print(img.cheap)的呀,怎么回事?)
求各位大佬解答!
谢谢! 本帖最后由 逃兵 于 2021-5-10 21:31 编辑
print(img.shape)
https://www.bilibili.com/video/BV1kJ41147s1
视频4:30处
页:
[1]