import numpy as np
import cv2 as cv
path_image_data = 'C:/Users/10107472/Desktop/my_yolo/data/image/'
image = np.zeros((5, 416, 416, 3))
print(image.shape)
for i in range(5): # 读取5张图片
a = str(i)
b = cv.imread(path_image_data+a+'.bmp')
b = cv.resize(b, (416, 416))
image[i] = b # 将图片保存该矩阵中,这一步实际已经将值保存在了image中了
print(image.shape)
cv.imshow("original_image", image[2])
image=np.asanyarray(image,dtype=np.uint8) # 关键 np.uint8 ,使其可以打印出图片
cv.imshow('change_image', image[2])
cv.waitKey()