【发布时间】:2018-02-23 18:06:45
【问题描述】:
您好,我正在尝试从使用 OpenCv 加载的图像中重塑一个充满像素数据的数组。生成的组合数组的形状为 (100,28,28,3) 我正在尝试使其成形 (100,28,28) 并且不能使用 np.delete 或 reshape 完全删除它。任何帮助都会很棒!到目前为止,这是我的代码:
import cv2
import glob
import numpy as np
hand_dig = []
files = glob.glob ("C:/Users/xxx/Desktop/digits/hand/*.PNG")
for myFile in files:
print(myFile)
image = cv2.imread (myFile)
hand_dig.append (image)
print('hand_digit shape:', np.array(hand_dig).shape)
hand_dig=np.reshape(hand_dig,(100,28,28))
print(hand_dig.shape)
【问题讨论】:
标签: python arrays image numpy reshape