简体   繁体   English

成功导入 OpenCV,但无法正常工作

[英]successfully import the OpenCV, but can't get it work

I am new to python.我是python的新手。 Just trying to get the basic idea of python.只是想了解python的基本概念。 Here is how I try and get error msg, after I installed the package.这是我安装软件包后尝试获取错误消息的方法。

import cv2
import numpy as np
img = cv2.imread('lena.jpg')

print(img.shape)

but i just get a 'NoneType' msg.但我只收到一个“NoneType”消息。

It seems I successfully import the openCV package, but I just can't use its functions.好像我成功导入了openCV包,但是我就是不能使用它的功能。

I did move the 'lena.jpg' to the same directory, but still get error msg.我确实将“lena.jpg”移动到同一目录,但仍然收到错误消息。

Please advise how I can move on.请告诉我如何继续前进。

错误信息

莉娜和我们在一起

It's most likely, that lena.jpg is not in your current working directory.最有可能的是, lena.jpg不在您当前的工作目录中。 Try specifying the exact path to your image or moving the file to the same directory as your test.py .尝试指定图像的确切路径或将文件移动到与test.py相同的目录。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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