AttributeError Traceback (most recent call last) <ipython-input-5-c69e15409517> in <module>() 1 #预处理 ----> 2 original_image = imutils.resize(original_image, width=500 ) 3 gray_image = cv2.cvtColor(original_image, cv2.COLOR_BGR2GRAY) 4 gray_image = cv2.bilateralFilter(gray_image, 11, 17, 17) D:\360downloads\Anaconda\envs\tensorflow_cpu\lib\site-packages\imutils\convenience.py in resize(image, width, height, inter) 67 # grab the image size 68 dim = None ---> 69 (h, w) = image.shape[:2] 70 71 # if both the width and height are None, then return the AttributeError: 'NoneType' object has no attribute 'shape'
时间: 2024-02-14 19:30:08 浏览: 165
python报错: 'list' object has no attribute 'shape'的解决
5星 · 资源好评率100%
您好!根据错误信息,看起来您的 `original_image` 变量是一个空对象(`NoneType`),因此无法获取其属性 `shape`。请确保您已经正确加载了图像,并将其赋给 `original_image` 变量。您可以使用 OpenCV 的 `imread()` 函数加载图像文件,如下所示:
```python
import cv2
original_image = cv2.imread('image.jpg')
```
请将 `'image.jpg'` 替换为您要加载的图像文件的路径。如果您已经正确加载了图像,但仍然遇到此错误,请提供更多关于代码和图像加载的细节,以便我能够更好地帮助您解决问题。
阅读全文