簡體   English   中英

將 4D 批次瓷磚重塑為 3D 圖像 Numpy

[英]Reshape 4D batch of tiles to 3D Image in Numpy

本質上,我有一組 [36, 107, 107, 3] 形狀的圖像。 我想重塑這批圖像,以便生成的數組是一個形狀為 [642, 642, 3] 的圖像。 到目前為止,我所做的一切都導致圖像失真。 任何幫助表示贊賞。

請注意,這效率不高,但可以通過一些迭代來完成:

ims = np.ones(36, 107, 107, 3)

im_per_side = np.sqrt(ims.shape[0]).astype(int)

# Reshape so we have real axes with desired orientation of images.
ims = np.reshape(ims, [im_per_side, im_per_side, 107, 107, 3]

length_slices = []
for l in range(im_per_side):
  height_slice = []
  for h in range(im_per_side):
    height_slice.append(ims[l, h])
  length_slices.apppend(np.concatenate(im_layer, 1))

# Finally concatenate along the `length` axis.
final_ims = np.concatenate(length_slices, 0)

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM