imresize求助
from scipy.misc import imresize,imread报错: cannot import name 'imread' from 'scipy.misc'
在网上找了许多,说是现在的scipy没有了这些指令可以通过降库的版本
然后找到了改写方法
from imageio import imread 不会报错
但是imresiz用imageio不行
想知道还有什么改写方法吗 最直接的办法是贴上imresize函数
@ np.deprecate(message="'imresize' is deprecated in SciPy 1.0.0,"
"and will be removed in 1.3.0\n"
"Use Pillow instead ``numpy.array(Image.fromarray(arr).resize())``.")
def imresize(arr, size, interp='bilinear', mode=None):
im = Image.fromarray(arr, mode=mode)
ts = type(size)
if np.issubdtype(ts, np.signedinteger):
percent = size / 100.0
size = tuple((np.array(im.size)*percent).astype(int))
elif np.issubdtype(type(size), np.floating):
size = tuple((np.array(im.size)*size).astype(int))
else:
size = (size, size)
func = {'nearest': 0, 'lanczos': 1, 'bilinear': 2, 'bicubic': 3, 'cubic': 3}
imnew = im.resize(size, resample=func)
return np.array(imnew)
页:
[1]