python-3.x - 运行 OpenCV 和 imutils 的属性错误
问题描述
我尝试在 jupyter Notebook 上使用 OpenCV 运行以下代码来做一些人脸识别应用程序
# load the input image and show its dimensions, keeping in mind that
# images are represented as a multi-dimensional NumPy array with
# shape no. rows (height) x no. columns (width) x no. channels (depth)
image = cv2.imread("jp.png")
(h, w, d) = image.shape
print("width={}, height={}, depth={}".format(w, h, d))
# display the image to our screen -- we will need to click the window
# open by OpenCV and press a key on our keyboard to continue execution
cv2.imshow("Image", image)
cv2.waitKey(0)
但出现以下属性错误:
AttributeError Traceback (most recent call last)
<ipython-input-14-eaae43cadc51> in <module>
3 # shape no. rows (height) x no. columns (width) x no. channels (depth)
4 image = cv2.imread("jp.png")
----> 5 (h, w, d) = image.shape
6 print("width={}, height={}, depth={}".format(w, h, d))
7 # display the image to our screen -- we will need to click the window
AttributeError: 'NoneType' object has no attribute 'shape'
这里可能是什么问题?
解决方案
推荐阅读
- javascript - 如何使用 Nodejs 使用 findById 编辑和更新 MySQL 中的特定字段数据?
- javascript - twilio 是否为其 voip 通话提供音量控制?
- amazon-cognito - 如何将 Cognito(联合)身份 ID 映射到 Cognito 用户池 ID?
- python - 从 JSONS 列表中提取数据的问题
- c# - c#,winforms中如何将手机摄像头或其他摄像头连接到图片框?
- c++11 - libxl 库在 C++ 中的使用
- jquery - 为什么鼠标悬停和鼠标悬停时动画不会重复
- node.js - AWS lambda 调用 Facebook SDK 失败
- ruby-on-rails - 识别升序和降序或范围
- reporting-services - SSRS 参数的日期选择器(日历图标)未显示在 Microsoft Edge 中