module 'scipy.misc' has no attribute 'imresize'
时间: 2023-09-24 08:09:53 浏览: 116
This error occurs when you try to use the `imresize` function from the `scipy.misc` module, but it is not found.
The `imresize` function has been removed from `scipy.misc` since version 1.3.0. You can instead use the `resize` function from the `scipy.ndimage` module to resize images.
Here's an example:
```python
from scipy import ndimage
from PIL import Image
# Load image
img = Image.open('image.jpg')
# Resize image
resized_img = ndimage.zoom(img, (0.5, 0.5, 1))
# Save resized image
resized_img = Image.fromarray(resized_img.astype('uint8'))
resized_img.save('resized_image.jpg')
```
In this example, `ndimage.zoom` resizes the image by 50%. You can adjust the zoom factor to resize the image to the desired size.
阅读全文