def load_cube_img(src_path, rows, cols, size):
img = cv2.imread(src_path, cv2.IMREAD_GRAYSCALE)
# assert rows * size == cube_img.shape[0]
# assert cols * size == cube_img.shape[1]
res = numpy.zeros((rows * cols, size, size))
img_height = size
img_width = size
for row in range(rows):
for col in range(cols):
src_y = row * img_height
src_x = col * img_width
res[row * cols + col] = img[src_y:src_y + img_height, src_x:src_x + img_width]
return res
评论列表
文章目录