我想拍摄一张图像,改变图像的比例,而它是一个numpy数组。 我想使用本机NumPy函数,不带PIL、cv2、SciPy等
现在我有这个:
from copy import copy
import numpy as np
from scipy import misc
img = misc.face() # racoon from SciPy(np.ndarray)
img2 = copy(img) # copy of racoon, because misc.face() is Descriptor(?)
img2.shape() # (768, 1024, 3)
我需要的形状=(30724096,3)
我可以很容易地用枕头
CONVERT_IMAGE = Image.fromarray(img.astype('uint8'), 'RGB')
CONVERT_IMAGE = CONVERT_IMAGE.resize((4096, 3072), Image.NEAREST)
IMAGE_AS_ARRAY = np.asarray(CONVERT_IMAGE)
IMAGE_AS_ARRAY.shape # 3072 4096 3
但是我真的需要只使用NumPy函数,而不使用其他lib
你能帮我吗?我在NumPy和3D阵列方面真的很弱
仅限于使用某些缩放因子} 两次来获得所述结果:
n
进行整整数上缩放,并且不使用实际插值,您可以使用^{以下是一些输出:
相关问题 更多 >
编程相关推荐