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 15:30:08 浏览: 172
您好!根据错误信息,看起来您的 `original_image` 变量是一个空对象(`NoneType`),因此无法获取其属性 `shape`。请确保您已经正确加载了图像,并将其赋给 `original_image` 变量。您可以使用 OpenCV 的 `imread()` 函数加载图像文件,如下所示:
```python
import cv2
original_image = cv2.imread('image.jpg')
```
请将 `'image.jpg'` 替换为您要加载的图像文件的路径。如果您已经正确加载了图像,但仍然遇到此错误,请提供更多关于代码和图像加载的细节,以便我能够更好地帮助您解决问题。
相关问题
AttributeError Traceback (most recent call last) <ipython-input-26-7401c2f31978> in <module>
It seems like you are trying to run some code in Python and getting an `AttributeError`. Can you please provide more information about the error, such as the full traceback and the code that you are running?
AttributeError Traceback (most recent call last) <ipython-input-18-484e38e099dc> in <module>() 1 from sklearn import preprocessing ----> 2 minmiax_scale = preprocessing.MinMaxSacler((0,1)) AttributeError: module 'sklearn.preprocessing' has no attribute 'MinMaxSacler'
您好!根据错误信息,看起来是由于您拼写错误导致的。正确的类名应该是 `MinMaxScaler` 而不是 `MinMaxSacler`。请修改代码如下:
```python
from sklearn import preprocessing
minmax_scale = preprocessing.MinMaxScaler((0,1))
```
请注意修改后的代码中的 `MinMaxScaler` 拼写正确。如果还有其他问题,请随时提问。
阅读全文